[mirotalksfu] - add chat speech recognition
هذا الالتزام موجود في:
@@ -31,6 +31,7 @@ Open the app with the following **supported browsers** and many more.
|
|||||||
- Screen Sharing to present documents, slides, and more ...
|
- Screen Sharing to present documents, slides, and more ...
|
||||||
- File Sharing, share any files to your participants in the room
|
- File Sharing, share any files to your participants in the room
|
||||||
- Chat with Emoji Picker to show you feeling and the possibility to Save the conversations
|
- Chat with Emoji Picker to show you feeling and the possibility to Save the conversations
|
||||||
|
- Speech recognition, ability to identify a person based on their voiceprint.
|
||||||
- Advance collaborative whiteboard for the teachers
|
- Advance collaborative whiteboard for the teachers
|
||||||
- Select Microphone - Speaker and Video source
|
- Select Microphone - Speaker and Video source
|
||||||
- Recording your Screen, Audio, or Video
|
- Recording your Screen, Audio, or Video
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ function initClient() {
|
|||||||
setTippy('participantsRefreshBtn', 'Refresh', 'top');
|
setTippy('participantsRefreshBtn', 'Refresh', 'top');
|
||||||
setTippy('chatMessage', 'Press enter to send', 'top-start');
|
setTippy('chatMessage', 'Press enter to send', 'top-start');
|
||||||
setTippy('chatSendButton', 'Send', 'top');
|
setTippy('chatSendButton', 'Send', 'top');
|
||||||
|
setTippy('chatSpeechStartButton', 'Start speech recognition', 'top');
|
||||||
|
setTippy('chatSpeechStopButton', 'Stop speech recognition', 'top');
|
||||||
setTippy('chatEmojiButton', 'Emoji', 'top');
|
setTippy('chatEmojiButton', 'Emoji', 'top');
|
||||||
setTippy('chatCloseEmojiButton', 'Close emoji', 'top');
|
setTippy('chatCloseEmojiButton', 'Close emoji', 'top');
|
||||||
setTippy('chatCleanButton', 'Clean', 'bottom');
|
setTippy('chatCleanButton', 'Clean', 'bottom');
|
||||||
@@ -469,6 +471,9 @@ function roomIsReady() {
|
|||||||
show(chatButton);
|
show(chatButton);
|
||||||
show(chatSendButton);
|
show(chatSendButton);
|
||||||
show(chatEmojiButton);
|
show(chatEmojiButton);
|
||||||
|
if (isWebkitSpeechRecognitionSupported) {
|
||||||
|
show(chatSpeechStartButton);
|
||||||
|
}
|
||||||
if (DetectRTC.isMobileDevice) {
|
if (DetectRTC.isMobileDevice) {
|
||||||
show(swapCameraButton);
|
show(swapCameraButton);
|
||||||
setChatSize();
|
setChatSize();
|
||||||
@@ -633,6 +638,12 @@ function handleButtons() {
|
|||||||
chatCloseEmojiButton.onclick = () => {
|
chatCloseEmojiButton.onclick = () => {
|
||||||
rc.toggleChatEmoji();
|
rc.toggleChatEmoji();
|
||||||
};
|
};
|
||||||
|
chatSpeechStartButton.onclick = () => {
|
||||||
|
startSpeech(true);
|
||||||
|
};
|
||||||
|
chatSpeechStopButton.onclick = () => {
|
||||||
|
startSpeech(false);
|
||||||
|
};
|
||||||
fullScreenButton.onclick = () => {
|
fullScreenButton.onclick = () => {
|
||||||
rc.toggleFullScreen();
|
rc.toggleFullScreen();
|
||||||
};
|
};
|
||||||
|
|||||||
44
public/js/SpeechRec.js
Normal file
44
public/js/SpeechRec.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
let isWebkitSpeechRecognitionSupported = false;
|
||||||
|
let recognition;
|
||||||
|
|
||||||
|
if ('webkitSpeechRecognition' in window) {
|
||||||
|
recognition = new webkitSpeechRecognition();
|
||||||
|
|
||||||
|
recognition.maxAlternatives = 1;
|
||||||
|
recognition.continuous = true;
|
||||||
|
|
||||||
|
recognition.onstart = function () {
|
||||||
|
console.log('Start speech recognition');
|
||||||
|
hide(chatSpeechStartButton);
|
||||||
|
show(chatSpeechStopButton);
|
||||||
|
};
|
||||||
|
|
||||||
|
recognition.onresult = (e) => {
|
||||||
|
let current = e.resultIndex;
|
||||||
|
let transcript = e.results[current][0].transcript;
|
||||||
|
chatMessage.value = transcript;
|
||||||
|
};
|
||||||
|
|
||||||
|
recognition.onerror = function (event) {
|
||||||
|
console.warn('Speech recognition error', event.error);
|
||||||
|
};
|
||||||
|
|
||||||
|
recognition.onend = function () {
|
||||||
|
console.log('Stop speech recognition');
|
||||||
|
show(chatSpeechStartButton);
|
||||||
|
hide(chatSpeechStopButton);
|
||||||
|
};
|
||||||
|
|
||||||
|
isWebkitSpeechRecognitionSupported = true;
|
||||||
|
console.info('Browser supports webkitSpeechRecognition');
|
||||||
|
} else {
|
||||||
|
console.warn('This browser not supports webkitSpeechRecognition');
|
||||||
|
}
|
||||||
|
|
||||||
|
function startSpeech(action) {
|
||||||
|
if (action) {
|
||||||
|
recognition.start();
|
||||||
|
} else {
|
||||||
|
recognition.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -75,6 +75,7 @@
|
|||||||
<script src="../sfu/MediasoupClient.js"></script>
|
<script src="../sfu/MediasoupClient.js"></script>
|
||||||
<script src="../js/Room.js"></script>
|
<script src="../js/Room.js"></script>
|
||||||
<script src="../js/RoomClient.js"></script>
|
<script src="../js/RoomClient.js"></script>
|
||||||
|
<script src="../js/SpeechRec.js"></script>
|
||||||
<script src="../js/VideoGrid.js"></script>
|
<script src="../js/VideoGrid.js"></script>
|
||||||
<script src="https://kit.fontawesome.com/d2f1016e6f.js" crossorigin="anonymous"></script>
|
<script src="https://kit.fontawesome.com/d2f1016e6f.js" crossorigin="anonymous"></script>
|
||||||
<script src="https://cdn.rawgit.com/muaz-khan/DetectRTC/master/DetectRTC.js"></script>
|
<script src="https://cdn.rawgit.com/muaz-khan/DetectRTC/master/DetectRTC.js"></script>
|
||||||
@@ -336,6 +337,12 @@ access to use this app.
|
|||||||
<button id="chatEmojiButton" class="hidden">
|
<button id="chatEmojiButton" class="hidden">
|
||||||
<i class="fas fa-smile"></i>
|
<i class="fas fa-smile"></i>
|
||||||
</button>
|
</button>
|
||||||
|
<button id="chatSpeechStartButton" class="hidden">
|
||||||
|
<i class="fas fa-microphone-slash"></i>
|
||||||
|
</button>
|
||||||
|
<button id="chatSpeechStopButton" class="hidden">
|
||||||
|
<i class="fas fa-microphone"></i>
|
||||||
|
</button>
|
||||||
<button id="chatSendButton" class="hidden">
|
<button id="chatSendButton" class="hidden">
|
||||||
<i class="fas fa-paper-plane"></i>
|
<i class="fas fa-paper-plane"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم