[mirotalksfu] - fix audio
هذا الالتزام موجود في:
@@ -73,6 +73,9 @@ const wbHeight = 600;
|
|||||||
|
|
||||||
const swalImageUrl = '../images/pricing-illustration.svg';
|
const swalImageUrl = '../images/pricing-illustration.svg';
|
||||||
|
|
||||||
|
// Media
|
||||||
|
const sinkId = 'sinkId' in HTMLMediaElement.prototype;
|
||||||
|
|
||||||
// ####################################################
|
// ####################################################
|
||||||
// LOCAL STORAGE
|
// LOCAL STORAGE
|
||||||
// ####################################################
|
// ####################################################
|
||||||
@@ -447,7 +450,6 @@ async function enumerateAudioDevices(stream) {
|
|||||||
.then(async () => {
|
.then(async () => {
|
||||||
await stopTracks(stream);
|
await stopTracks(stream);
|
||||||
isEnumerateAudioDevices = true;
|
isEnumerateAudioDevices = true;
|
||||||
const sinkId = 'sinkId' in HTMLMediaElement.prototype;
|
|
||||||
speakerSelect.disabled = !sinkId;
|
speakerSelect.disabled = !sinkId;
|
||||||
// Check if there is speakers
|
// Check if there is speakers
|
||||||
if (!sinkId || initSpeakerSelect.options.length === 0) {
|
if (!sinkId || initSpeakerSelect.options.length === 0) {
|
||||||
@@ -1606,8 +1608,7 @@ async function setSelectsInit() {
|
|||||||
current: speakerSelect.value,
|
current: speakerSelect.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Fix me, keep for now always default speaker...
|
if (!initSpeakerExist || !speakerExist) {
|
||||||
if (true || !initSpeakerExist || !speakerExist) {
|
|
||||||
console.log('04.2 ----> Speaker devices seems changed, use default index 0');
|
console.log('04.2 ----> Speaker devices seems changed, use default index 0');
|
||||||
initSpeakerSelect.selectedIndex = 0;
|
initSpeakerSelect.selectedIndex = 0;
|
||||||
speakerSelect.selectedIndex = 0;
|
speakerSelect.selectedIndex = 0;
|
||||||
@@ -1765,7 +1766,7 @@ function handleSelects() {
|
|||||||
refreshLsDevices();
|
refreshLsDevices();
|
||||||
};
|
};
|
||||||
speakerSelect.onchange = () => {
|
speakerSelect.onchange = () => {
|
||||||
rc.attachSinkId(rc.myAudioEl, speakerSelect.value);
|
rc.changeAudioDestination();
|
||||||
refreshLsDevices();
|
refreshLsDevices();
|
||||||
};
|
};
|
||||||
switchPushToTalk.onchange = (e) => {
|
switchPushToTalk.onchange = (e) => {
|
||||||
|
|||||||
@@ -1697,9 +1697,6 @@ class RoomClient {
|
|||||||
this.myAudioEl = elem;
|
this.myAudioEl = elem;
|
||||||
this.localAudioEl.appendChild(elem);
|
this.localAudioEl.appendChild(elem);
|
||||||
this.attachMediaStream(elem, stream, type, 'Producer');
|
this.attachMediaStream(elem, stream, type, 'Producer');
|
||||||
if (this.isAudioAllowed && !this._moderator.audio_start_muted && !speakerSelect.disabled) {
|
|
||||||
this.attachSinkId(elem, speakerSelect.value);
|
|
||||||
}
|
|
||||||
console.log('[addProducer] audio-element-count', this.localAudioEl.childElementCount);
|
console.log('[addProducer] audio-element-count', this.localAudioEl.childElementCount);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -2104,6 +2101,9 @@ class RoomClient {
|
|||||||
this.handlePV(id + '___' + audioConsumerId);
|
this.handlePV(id + '___' + audioConsumerId);
|
||||||
this.setPeerAudio(remotePeerId, remotePeerAudio);
|
this.setPeerAudio(remotePeerId, remotePeerAudio);
|
||||||
}
|
}
|
||||||
|
if (sinkId && speakerSelect.value) {
|
||||||
|
this.changeAudioDestination(elem);
|
||||||
|
}
|
||||||
console.log('[Add audioConsumers]', this.audioConsumers);
|
console.log('[Add audioConsumers]', this.audioConsumers);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -2377,6 +2377,18 @@ class RoomClient {
|
|||||||
console.log(who + ' Success attached media ' + type);
|
console.log(who + ' Success attached media ' + type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async changeAudioDestination(audioElement = false) {
|
||||||
|
const audioDestination = speakerSelect.value;
|
||||||
|
if (audioElement) {
|
||||||
|
await this.attachSinkId(audioElement, audioDestination);
|
||||||
|
} else {
|
||||||
|
const audioElements = this.remoteAudioEl.querySelectorAll('audio');
|
||||||
|
audioElements.forEach(async (audioElement) => {
|
||||||
|
await this.attachSinkId(audioElement, audioDestination);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async attachSinkId(elem, sinkId) {
|
async attachSinkId(elem, sinkId) {
|
||||||
if (typeof elem.sinkId !== 'undefined') {
|
if (typeof elem.sinkId !== 'undefined') {
|
||||||
elem.setSinkId(sinkId)
|
elem.setSinkId(sinkId)
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم