diff --git a/net/web/src/constants/Strings.js b/net/web/src/constants/Strings.js
index 20eef60e..cab22a12 100644
--- a/net/web/src/constants/Strings.js
+++ b/net/web/src/constants/Strings.js
@@ -117,7 +117,6 @@ export const en = {
copied: 'Copied',
accounts: 'Accounts',
accessAccount: 'Access Account',
- createAccount: 'Create Account',
browserLink: 'Browser Link',
mobileToken: 'Mobile Token',
createLink: 'Create Account Link',
@@ -126,7 +125,6 @@ export const en = {
disableAccount: 'Disable Account',
enableAccount: 'Enable Account',
deleteAccount: 'Delete Account',
- settings: 'Settings',
hostHint: 'domain:port/app',
federatedHost: 'Federated Host',
storageLimit: 'Storage Limit (GB) / Account',
@@ -153,7 +151,6 @@ export const en = {
deleteMessage: 'Deleting Message',
messageHint: 'Are you sure you want to delete the message?',
- newMessage: 'New Message',
attachImage: 'Attach Image',
attachVideo: 'Attach Video',
attachAudio: 'Attach Audio',
@@ -301,7 +298,6 @@ export const fr = {
copied: 'Copié',
accounts: 'Comptes',
accessAccount: 'Accéder au Compte',
- createAccount: 'Créer un Compte',
browserLink: 'Lien du Navigateur',
mobileToken: 'Code Mobile',
createLink: 'Lien pour Créer un Compte',
@@ -310,7 +306,6 @@ export const fr = {
disableAccount: 'Désactiver le Compte',
enableAccount: 'Activer le Compte',
deleteAccount: 'Supprimer le Compte',
- settings: 'Paramètres',
hostHint: 'domaine:port/app',
federatedHost: 'Hôte Fédéré',
storageLimit: 'Limite de Espace (Go) / Compte',
@@ -337,7 +332,6 @@ export const fr = {
deleteMessage: 'Suppression du Message',
messageHint: 'Êtes-vous Sûr de Vouloir Supprimer le Message?',
- newMessage: 'Nouveau Message',
attachImage: 'Joindre une Image',
attachVideo: 'Joindre une Vidéo',
attachAudio: 'Joindre un Audio',
diff --git a/net/web/src/context/useRingContext.hook.js b/net/web/src/context/useRingContext.hook.js
index bb3430e6..4ceac9ea 100644
--- a/net/web/src/context/useRingContext.hook.js
+++ b/net/web/src/context/useRingContext.hook.js
@@ -134,8 +134,31 @@ export function useRingContext() {
processing.current = false;
}
- const transmit = async (policy, ice) => {
+ const getAudioStream = async (audioId) => {
+ try {
+ if (audioId) {
+ return await navigator.mediaDevices.getUserMedia({ video: false, audio: { deviceId: audioId } });
+ }
+ }
+ catch (err) {
+ console.log(err);
+ }
+ return await navigator.mediaDevices.getUserMedia({ video: false, audio: true });
+ }
+ const getVideoStream = async (videoId) => {
+ try {
+ if (videoId) {
+ return await navigator.mediaDevices.getUserMedia({ video: { deviceId: videoId }, audio: false });
+ }
+ }
+ catch (err) {
+ console.log(err);
+ }
+ return await navigator.mediaDevices.getUserMedia({ video: true, audio: false });
+ }
+
+ const transmit = async (policy, ice, audioId) => {
pc.current = new RTCPeerConnection({ iceServers: ice });
pc.current.ontrack = (ev) => {
if (!stream.current) {
@@ -164,13 +187,7 @@ export function useRingContext() {
};
try {
- const devices = await navigator.mediaDevices.enumerateDevices();
- console.log('>> ', devices);
-
- const stream = await navigator.mediaDevices.getUserMedia({
- video: false,
- audio: true,
- });
+ const stream = await getAudioStream(audioId);
accessAudio.current = true;
updateState({ localAudio: true });
for (const track of stream.getTracks()) {
@@ -185,7 +202,7 @@ export function useRingContext() {
}
}
- const connect = async (policy, node, token, clearRing, clearAlive, ice) => {
+ const connect = async (policy, audioId, node, token, clearRing, clearAlive, ice) => {
// connect signal socket
connected.current = false;
@@ -209,7 +226,7 @@ export function useRingContext() {
updateState({ callStatus: "connected" });
if (policy === 'polite') {
connected.current = true;
- transmit('polite', ice);
+ transmit('polite', ice, audioId);
polite();
}
}
@@ -260,7 +277,7 @@ export function useRingContext() {
ws.current.send(JSON.stringify({ AppToken: token }));
if (policy === 'impolite') {
connected.current = true;
- transmit('impolite', ice);
+ transmit('impolite', ice, audioId);
impolite();
}
}
@@ -317,7 +334,7 @@ export function useRingContext() {
}
}
},
- accept: async (cardId, callId, contactNode, contactToken, calleeToken, iceUrl, iceUsername, icePassword) => {
+ accept: async (cardId, callId, contactNode, contactToken, calleeToken, iceUrl, iceUsername, icePassword, audioId) => {
if (calling.current) {
throw new Error("active session");
}
@@ -332,7 +349,7 @@ export function useRingContext() {
updateState({ ringing: ringing.current, callStatus: "connecting", cardId });
calling.current = { callId, contactNode, contactToken, host: false };
- await connect('impolite', contactNode, calleeToken, () => {}, () => {}, ice);
+ await connect('impolite', audioId, contactNode, calleeToken, () => {}, () => {}, ice);
}
},
end: async () => {
@@ -362,7 +379,7 @@ export function useRingContext() {
}
}
},
- call: async (cardId, contactNode, contactToken) => {
+ call: async (cardId, contactNode, contactToken, audioId) => {
if (calling.current) {
throw new Error("active session");
}
@@ -416,17 +433,11 @@ export function useRingContext() {
updateState({ callStatus: "ringing" });
calling.current = { callId: id, host: true };
const ice = [{ urls: iceUrl, username: iceUsername, credential: icePassword }];
- await connect('polite', window.location.host, callerToken, () => clearInterval(ringInterval), () => clearInterval(aliveInterval), ice);
+ await connect('polite', audioId, window.location.host, callerToken, () => clearInterval(ringInterval), () => clearInterval(aliveInterval), ice);
},
- enableVideo: async () => {
+ enableVideo: async (videoId) => {
if (!accessVideo.current) {
- const devices = await navigator.mediaDevices.enumerateDevices();
- console.log('>> ', devices);
-
- const stream = await navigator.mediaDevices.getUserMedia({
- video: true,
- audio: true,
- });
+ const stream = await getVideoStream(videoId);
accessVideo.current = true;
accessAudio.current = true;
updateState({ localStream: stream });
diff --git a/net/web/src/context/useSettingsContext.hook.js b/net/web/src/context/useSettingsContext.hook.js
index 0ffa9521..f4ee7169 100644
--- a/net/web/src/context/useSettingsContext.hook.js
+++ b/net/web/src/context/useSettingsContext.hook.js
@@ -18,9 +18,9 @@ export function useSettingsContext() {
strings: en,
dateFormat: 'mm/dd',
timeFormat: '12h',
- audioInput: null,
+ audioId: null,
audioInputs: [],
- videoInput: null,
+ videoId: null,
videoInputs: [],
});
@@ -75,6 +75,7 @@ export function useSettingsContext() {
getDevices('video').then(video => {
updateState({ videoInputs: video });
});
+ // eslint-disable-next-line
}, [state.strings]);
useEffect(() => {
@@ -134,9 +135,9 @@ export function useSettingsContext() {
}
}
- const audioInput = localStorage.getItem('audio_input');
- const videoInput = localStorage.getItem('video_input');
- updateState({ audioInput, videoInput });
+ const audioId = localStorage.getItem('audio_input');
+ const videoId = localStorage.getItem('video_input');
+ updateState({ audioId, videoId });
return () => {
window.removeEventListener('resize', handleResize);
@@ -193,13 +194,13 @@ export function useSettingsContext() {
localStorage.setItem('time_format', timeFormat);
updateState({ timeFormat });
},
- setAudioInput: (audioInput) => {
- localStorage.setItem('audio_input', audioInput);
- updateState({ audioInput });
+ setAudioInput: (audioId) => {
+ localStorage.setItem('audio_input', audioId);
+ updateState({ audioId });
},
- setVideoInput: (videoInput) => {
- localStorage.setItem('video_input', videoInput);
- updateState({ videoInput });
+ setVideoInput: (videoId) => {
+ localStorage.setItem('video_input', videoId);
+ updateState({ videoId });
},
}
diff --git a/net/web/src/session/account/profile/Profile.jsx b/net/web/src/session/account/profile/Profile.jsx
index 6343aae7..932c925e 100644
--- a/net/web/src/session/account/profile/Profile.jsx
+++ b/net/web/src/session/account/profile/Profile.jsx
@@ -1,6 +1,6 @@
import { useRef, useCallback } from 'react';
import { Modal, Input, Button, Switch } from 'antd';
-import { LogoutContent, ProfileWrapper, ProfileDetailsWrapper, ProfileImageWrapper } from './Profile.styled';
+import { ProfileWrapper, ProfileDetailsWrapper, ProfileImageWrapper } from './Profile.styled';
import { useProfile } from './useProfile.hook';
import { Logo } from 'logo/Logo';
import { AccountAccess } from './accountAccess/AccountAccess';
@@ -52,24 +52,6 @@ export function Profile({ closeProfile }) {
}
}
- const logout = () => {
- modal.confirm({
- title: {state.strings.confirmLogout},
- icon: