diff --git a/lib/src/support/platform.dart b/lib/src/support/platform.dart index ebf552583..979924f04 100644 --- a/lib/src/support/platform.dart +++ b/lib/src/support/platform.dart @@ -36,6 +36,8 @@ bool lkPlatformIsTest() => Platform.environment.containsKey('FLUTTER_TEST'); BrowserType lkBrowser() => lkBrowserImplementation(); +BrowserVersion lkBrowserVersion() => lkBrowserVersionImplementation(); + enum PlatformType { web, windows, @@ -54,3 +56,16 @@ enum BrowserType { wkWebView, unknown, } + +class BrowserVersion { + const BrowserVersion(this.major, this.minor, this.patch); + + /// The major version number: "1" in "1.2.3". + final int major; + + /// The minor version number: "2" in "1.2.3". + final int minor; + + /// The patch version number: "3" in "1.2.3". + final int patch; +} diff --git a/lib/src/support/platform/io.dart b/lib/src/support/platform/io.dart index fcf25ffe2..f06e7dca1 100644 --- a/lib/src/support/platform/io.dart +++ b/lib/src/support/platform/io.dart @@ -39,3 +39,7 @@ bool lkE2EESupportedImplementation() { BrowserType lkBrowserImplementation() { return BrowserType.unknown; } + +BrowserVersion lkBrowserVersionImplementation() { + return const BrowserVersion(0, 0, 0); +} diff --git a/lib/src/support/platform/web.dart b/lib/src/support/platform/web.dart index 06bd7378a..e50a904a8 100644 --- a/lib/src/support/platform/web.dart +++ b/lib/src/support/platform/web.dart @@ -41,3 +41,6 @@ BrowserType lkBrowserImplementation() { if (browser.isWKWebView) return BrowserType.wkWebView; return BrowserType.unknown; } + +BrowserVersion lkBrowserVersionImplementation() => BrowserVersion( + browser.version.major, browser.version.minor, browser.version.patch); diff --git a/lib/src/track/local/local.dart b/lib/src/track/local/local.dart index b469ea36e..f8df8625d 100644 --- a/lib/src/track/local/local.dart +++ b/lib/src/track/local/local.dart @@ -154,6 +154,13 @@ abstract class LocalTrack extends Track { if (options.selfBrowserSurface != null) { constraints['selfBrowserSurface'] = options.selfBrowserSurface!; } + + // Remove resolution settings to fix low-resolution screen share on Safari 17. + // related bug: https://bugs.webkit.org/show_bug.cgi?id=263015 + if (lkBrowser() == BrowserType.safari && + lkBrowserVersion().major == 17) { + constraints['video'] = true; + } } stream = await rtc.navigator.mediaDevices.getDisplayMedia(constraints); } else {