[mirotalksfu] - fix for firefox, update dep
هذا الالتزام موجود في:
@@ -76,7 +76,7 @@ let BRAND = {
|
||||
},
|
||||
about: {
|
||||
imageUrl: '../images/mirotalk-logo.gif',
|
||||
title: '<strong>WebRTC SFU v1.9.06</strong>',
|
||||
title: '<strong>WebRTC SFU v1.9.07</strong>',
|
||||
html: `
|
||||
<button
|
||||
id="support-button"
|
||||
|
||||
@@ -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.9.06
|
||||
* @version 1.9.07
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,7 @@ const isMobileDevice = deviceType === 'mobile';
|
||||
const isTabletDevice = deviceType === 'tablet';
|
||||
const isIPadDevice = parserResult.device.model?.toLowerCase() === 'ipad';
|
||||
const isDesktopDevice = deviceType === 'desktop';
|
||||
const isFirefox = parserResult.browser.name?.toLowerCase() === 'firefox';
|
||||
const thisInfo = getInfo();
|
||||
|
||||
const isEmbedded = window.self !== window.top;
|
||||
@@ -2465,6 +2466,9 @@ function handleMediaError(mediaType, err, redirectURL = false) {
|
||||
case 'OverconstrainedError':
|
||||
case 'ConstraintNotSatisfiedError':
|
||||
errMessage = 'Constraints cannot be satisfied by available devices';
|
||||
if (videoQuality.selectedIndex != 0) {
|
||||
videoQuality.selectedIndex = rc.videoQualitySelectedIndex;
|
||||
}
|
||||
break;
|
||||
case 'NotAllowedError':
|
||||
case 'PermissionDeniedError':
|
||||
@@ -5465,7 +5469,7 @@ function showAbout() {
|
||||
position: 'center',
|
||||
imageUrl: BRAND.about?.imageUrl && BRAND.about.imageUrl.trim() !== '' ? BRAND.about.imageUrl : image.about,
|
||||
customClass: { image: 'img-about' },
|
||||
title: BRAND.about?.title && BRAND.about.title.trim() !== '' ? BRAND.about.title : 'WebRTC SFU v1.9.06',
|
||||
title: BRAND.about?.title && BRAND.about.title.trim() !== '' ? BRAND.about.title : 'WebRTC SFU v1.9.07',
|
||||
html: `
|
||||
<br />
|
||||
<div id="about">
|
||||
|
||||
@@ -1911,18 +1911,7 @@ class RoomClient {
|
||||
return producer;
|
||||
} catch (err) {
|
||||
console.error('Produce error:', err);
|
||||
|
||||
handleMediaError(type, err);
|
||||
|
||||
if (!audio && !screen && videoQuality.selectedIndex != 0) {
|
||||
videoQuality.selectedIndex = this.videoQualitySelectedIndex;
|
||||
this.sound('alert');
|
||||
this.userLog(
|
||||
'error',
|
||||
`Your device doesn't support the selected video quality (${videoQuality.value}), please select the another one.`,
|
||||
'top-end'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2216,53 +2205,69 @@ class RoomClient {
|
||||
const defaultFrameRate = { ideal: 30 };
|
||||
const selectedValue = this.getSelectedIndexValue(videoFps);
|
||||
const customFrameRate = parseInt(selectedValue, 10);
|
||||
const frameRate = selectedValue === 'max' ? defaultFrameRate : { ideal: customFrameRate };
|
||||
const frameRate = selectedValue === 'max' ? defaultFrameRate : customFrameRate;
|
||||
|
||||
// Base constraints structure with dynamic values for resolution and frame rate
|
||||
const videoBaseConstraints = (width, height, exact = false) => ({
|
||||
audio: false,
|
||||
video: {
|
||||
width: exact ? { exact: width } : { ideal: width },
|
||||
height: exact ? { exact: height } : { ideal: height },
|
||||
deviceId: deviceId,
|
||||
aspectRatio: 1.777, // 16:9 aspect ratio
|
||||
frameRate: frameRate,
|
||||
},
|
||||
});
|
||||
// Helper to create constraints
|
||||
function createConstraints(width, height, frameRate, isIdeal = false) {
|
||||
const constraints = {
|
||||
width: isIdeal ? { ideal: width } : { exact: width },
|
||||
height: isIdeal ? { ideal: height } : { exact: height },
|
||||
};
|
||||
// Only add frameRate for non-Firefox browsers
|
||||
if (!isFirefox) {
|
||||
constraints.frameRate = isIdeal ? { ideal: frameRate } : frameRate;
|
||||
}
|
||||
return constraints;
|
||||
}
|
||||
|
||||
const videoResolutionMap = {
|
||||
qvga: { width: 320, height: 240, exact: true },
|
||||
vga: { width: 640, height: 480, exact: true },
|
||||
hd: { width: 1280, height: 720, exact: true },
|
||||
fhd: { width: 1920, height: 1080, exact: true },
|
||||
'2k': { width: 2560, height: 1440, exact: true },
|
||||
'4k': { width: 3840, height: 2160, exact: true },
|
||||
'6k': { width: 6144, height: 3456, exact: true },
|
||||
'8k': { width: 7680, height: 4320, exact: true },
|
||||
};
|
||||
|
||||
let videoConstraints;
|
||||
let constraints = {};
|
||||
|
||||
switch (videoQuality.value) {
|
||||
case 'default':
|
||||
// Default ideal HD resolution
|
||||
videoConstraints = videoBaseConstraints(1280, 720);
|
||||
constraints = createConstraints(1280, 720, 30, true);
|
||||
videoFps.selectedIndex = 0;
|
||||
videoFps.disabled = true;
|
||||
break;
|
||||
case 'qvga':
|
||||
constraints = createConstraints(320, 240, frameRate, isFirefox);
|
||||
break;
|
||||
case 'vga':
|
||||
constraints = createConstraints(640, 480, frameRate, isFirefox);
|
||||
break;
|
||||
case 'hd':
|
||||
constraints = createConstraints(1280, 720, frameRate, isFirefox);
|
||||
break;
|
||||
case 'fhd':
|
||||
constraints = createConstraints(1920, 1080, frameRate, isFirefox);
|
||||
break;
|
||||
case '2k':
|
||||
constraints = createConstraints(2560, 1440, frameRate, isFirefox);
|
||||
break;
|
||||
case '4k':
|
||||
constraints = createConstraints(3840, 2160, frameRate, isFirefox);
|
||||
break;
|
||||
case '6k':
|
||||
constraints = createConstraints(6144, 3456, frameRate, isFirefox);
|
||||
break;
|
||||
case '8k':
|
||||
constraints = createConstraints(7680, 4320, frameRate, isFirefox);
|
||||
break;
|
||||
default:
|
||||
// Ideal Full HD if no match found in the video resolution map
|
||||
const { width, height, exact } = videoResolutionMap[videoQuality.value] || {
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
};
|
||||
videoConstraints = videoBaseConstraints(width, height, exact);
|
||||
// fallback to HD
|
||||
constraints = createConstraints(1280, 720, frameRate, isFirefox);
|
||||
break;
|
||||
}
|
||||
|
||||
this.videoQualitySelectedIndex = videoQuality.selectedIndex;
|
||||
// Add deviceId if provided
|
||||
if (deviceId) {
|
||||
constraints.deviceId = deviceId;
|
||||
}
|
||||
|
||||
return videoConstraints;
|
||||
// Compose final constraints object
|
||||
return {
|
||||
audio: false,
|
||||
video: constraints,
|
||||
};
|
||||
}
|
||||
|
||||
getScreenConstraints() {
|
||||
@@ -2272,15 +2277,20 @@ class RoomClient {
|
||||
const frameRate = selectedValue === 'max' ? defaultFrameRate : { ideal: customFrameRate };
|
||||
|
||||
// Base constraints structure with dynamic values for resolution and frame rate
|
||||
const screenBaseConstraints = (width, height) => ({
|
||||
audio: true,
|
||||
video: {
|
||||
const screenBaseConstraints = (width, height) => {
|
||||
const videoConstraints = {
|
||||
width: { ideal: width },
|
||||
height: { ideal: height },
|
||||
aspectRatio: 1.777, // 16:9 aspect ratio
|
||||
frameRate: frameRate,
|
||||
},
|
||||
});
|
||||
};
|
||||
if (!isFirefox) {
|
||||
videoConstraints.frameRate = frameRate;
|
||||
}
|
||||
return {
|
||||
audio: true,
|
||||
video: videoConstraints,
|
||||
};
|
||||
};
|
||||
|
||||
const screenResolutionMap = {
|
||||
hd: { width: 1280, height: 720 },
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم