Skip to content

Commit

Permalink
[example][screen_sharing] Allow input the screen capture frame rate b…
Browse files Browse the repository at this point in the history
…y user
  • Loading branch information
littleGnAl committed Sep 13, 2024
1 parent c6c1e41 commit 62f0323
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions example/lib/examples/advanced/screen_sharing/screen_sharing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ class _ScreenShareDesktopState extends State<ScreenShareDesktop>
List<ScreenCaptureSourceInfo> _screenCaptureSourceInfos = [];
late ScreenCaptureSourceInfo _selectedScreenCaptureSourceInfo;

late final TextEditingController _screenShareFrameRateController;

@override
bool get isScreenShared => widget.isScreenShared;

Expand Down Expand Up @@ -587,6 +589,8 @@ class _ScreenShareDesktopState extends State<ScreenShareDesktop>
void initState() {
super.initState();

_screenShareFrameRateController = TextEditingController(text: '30');

_initScreenCaptureSourceInfos();
}

Expand All @@ -597,6 +601,14 @@ class _ScreenShareDesktopState extends State<ScreenShareDesktop>
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextField(
controller: _screenShareFrameRateController,
decoration:
const InputDecoration(hintText: 'Screen Sharing frame rate'),
),
const SizedBox(
height: 20,
),
_createDropdownButton(),
if (_screenCaptureSourceInfos.isNotEmpty)
Row(
Expand Down Expand Up @@ -627,18 +639,18 @@ class _ScreenShareDesktopState extends State<ScreenShareDesktop>
await rtcEngine.startScreenCaptureByDisplayId(
displayId: sourceId!,
regionRect: const Rectangle(x: 0, y: 0, width: 0, height: 0),
captureParams: const ScreenCaptureParameters(
captureParams: ScreenCaptureParameters(
captureMouseCursor: true,
frameRate: 30,
frameRate: int.parse(_screenShareFrameRateController.text),
));
} else if (_selectedScreenCaptureSourceInfo.type ==
ScreenCaptureSourceType.screencapturesourcetypeWindow) {
await rtcEngine.startScreenCaptureByWindowId(
windowId: sourceId!,
regionRect: const Rectangle(x: 0, y: 0, width: 0, height: 0),
captureParams: const ScreenCaptureParameters(
captureParams: ScreenCaptureParameters(
captureMouseCursor: true,
frameRate: 30,
frameRate: int.parse(_screenShareFrameRateController.text),
),
);
}
Expand Down

0 comments on commit 62f0323

Please sign in to comment.