[mirotalksfu] - add select devices before join
هذا الالتزام موجود في:
@@ -9,7 +9,7 @@
|
||||
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or buy 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.0.0
|
||||
* @version 1.0.1
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -66,30 +66,6 @@ const mediaType = {
|
||||
speaker: 'speakerType',
|
||||
};
|
||||
|
||||
const LOCAL_STORAGE_DEVICES = {
|
||||
audio: {
|
||||
count: 0,
|
||||
index: 0,
|
||||
select: null,
|
||||
},
|
||||
speaker: {
|
||||
count: 0,
|
||||
index: 0,
|
||||
select: null,
|
||||
},
|
||||
video: {
|
||||
count: 0,
|
||||
index: 0,
|
||||
select: null,
|
||||
},
|
||||
};
|
||||
|
||||
const DEVICES_COUNT = {
|
||||
audio: 0,
|
||||
speaker: 0,
|
||||
video: 0,
|
||||
};
|
||||
|
||||
const _EVENTS = {
|
||||
openRoom: 'openRoom',
|
||||
exitRoom: 'exitRoom',
|
||||
@@ -653,30 +629,7 @@ class RoomClient {
|
||||
// ####################################################
|
||||
|
||||
startLocalMedia() {
|
||||
let localStorageDevices = this.getLocalStorageDevices();
|
||||
console.log('08 ----> Get Local Storage Devices before', localStorageDevices);
|
||||
if (localStorageDevices) {
|
||||
microphoneSelect.selectedIndex = localStorageDevices.audio.index;
|
||||
speakerSelect.selectedIndex = localStorageDevices.speaker.index;
|
||||
videoSelect.selectedIndex = localStorageDevices.video.index;
|
||||
//
|
||||
if (DEVICES_COUNT.audio != localStorageDevices.audio.count) {
|
||||
console.log('08.1 ----> Audio devices seems changed, use default index 0');
|
||||
microphoneSelect.selectedIndex = 0;
|
||||
this.setLocalStorageDevices(mediaType.audio, microphoneSelect.selectedIndex, microphoneSelect.value);
|
||||
}
|
||||
if (DEVICES_COUNT.speaker != localStorageDevices.speaker.count) {
|
||||
console.log('08.2 ----> Speaker devices seems changed, use default index 0');
|
||||
speakerSelect.selectedIndex = 0;
|
||||
this.setLocalStorageDevices(mediaType.speaker, speakerSelect.selectedIndex, speakerSelect.value);
|
||||
}
|
||||
if (DEVICES_COUNT.video != localStorageDevices.video.count) {
|
||||
console.log('08.3 ----> Video devices seems changed, use default index 0');
|
||||
videoSelect.selectedIndex = 0;
|
||||
this.setLocalStorageDevices(mediaType.video, videoSelect.selectedIndex, videoSelect.value);
|
||||
}
|
||||
console.log('08.4 ----> Get Local Storage Devices after', this.getLocalStorageDevices());
|
||||
}
|
||||
console.log('08 ----> Start local media');
|
||||
if (this.isAudioAllowed) {
|
||||
console.log('09 ----> Start audio media');
|
||||
this.produce(mediaType.audio, microphoneSelect.value);
|
||||
@@ -1804,7 +1757,7 @@ class RoomClient {
|
||||
console.error('Attach SinkId error: ', errorMessage);
|
||||
this.userLog('error', errorMessage, 'top-end');
|
||||
speakerSelect.selectedIndex = 0;
|
||||
this.setLocalStorageDevices(mediaType.speaker, 0, speakerSelect.value);
|
||||
lS.setLocalStorageDevices(lS.MEDIA_TYPE.speaker, 0, speakerSelect.value);
|
||||
});
|
||||
} else {
|
||||
let error = `Browser seems doesn't support output device selection.`;
|
||||
@@ -4191,33 +4144,4 @@ class RoomClient {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ####################################################
|
||||
// LOCAL STORAGE DEVICES
|
||||
// ####################################################
|
||||
|
||||
setLocalStorageDevices(type, index, select) {
|
||||
switch (type) {
|
||||
case RoomClient.mediaType.audio:
|
||||
LOCAL_STORAGE_DEVICES.audio.count = DEVICES_COUNT.audio;
|
||||
LOCAL_STORAGE_DEVICES.audio.index = index;
|
||||
LOCAL_STORAGE_DEVICES.audio.select = select;
|
||||
break;
|
||||
case RoomClient.mediaType.video:
|
||||
LOCAL_STORAGE_DEVICES.video.count = DEVICES_COUNT.video;
|
||||
LOCAL_STORAGE_DEVICES.video.index = index;
|
||||
LOCAL_STORAGE_DEVICES.video.select = select;
|
||||
break;
|
||||
case RoomClient.mediaType.speaker:
|
||||
LOCAL_STORAGE_DEVICES.speaker.count = DEVICES_COUNT.speaker;
|
||||
LOCAL_STORAGE_DEVICES.speaker.index = index;
|
||||
LOCAL_STORAGE_DEVICES.speaker.select = select;
|
||||
break;
|
||||
}
|
||||
localStorage.setItem('LOCAL_STORAGE_DEVICES', JSON.stringify(LOCAL_STORAGE_DEVICES));
|
||||
}
|
||||
|
||||
getLocalStorageDevices() {
|
||||
return JSON.parse(localStorage.getItem('LOCAL_STORAGE_DEVICES'));
|
||||
}
|
||||
}
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم