Skip to content

Commit

Permalink
fix: default options for fast connect. (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwebrtc authored May 22, 2023
1 parent 3a049d0 commit 03a7672
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31
compileSdkVersion 33

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand Down
18 changes: 16 additions & 2 deletions example/lib/pages/connect.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,23 @@ class _ConnectPageState extends State<ConnectPage> {
defaultVideoPublishOptions: VideoPublishOptions(
simulcast: _simulcast,
),
defaultScreenShareCaptureOptions:
const ScreenShareCaptureOptions(useiOSBroadcastExtension: true),
defaultScreenShareCaptureOptions: const ScreenShareCaptureOptions(
useiOSBroadcastExtension: true,
params: VideoParameters(
dimensions: VideoDimensionsPresets.h1080_169,
encoding: VideoEncoding(
maxBitrate: 3 * 1000 * 1000,
maxFramerate: 15,
))),
e2eeOptions: e2eeOptions,
defaultCameraCaptureOptions: const CameraCaptureOptions(
maxFrameRate: 30,
params: VideoParameters(
dimensions: VideoDimensionsPresets.h720_169,
encoding: VideoEncoding(
maxBitrate: 2 * 1000 * 1000,
maxFramerate: 30,
))),
),
fastConnectOptions: _fastConnect
? FastConnectOptions(
Expand Down
23 changes: 14 additions & 9 deletions lib/src/core/room.dart
Original file line number Diff line number Diff line change
Expand Up @@ -201,30 +201,35 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
var audio = options.microphone;
if (audio.enabled != null && audio.enabled == true) {
if (audio.track != null) {
_localParticipant!
.publishAudioTrack(audio.track as LocalAudioTrack);
_localParticipant!.publishAudioTrack(audio.track as LocalAudioTrack,
publishOptions: roomOptions.defaultAudioPublishOptions);
} else {
_localParticipant!.setMicrophoneEnabled(true);
_localParticipant!.setMicrophoneEnabled(true,
audioCaptureOptions: roomOptions.defaultAudioCaptureOptions);
}
}

var video = options.camera;
if (video.enabled != null && video.enabled == true) {
if (video.track != null) {
_localParticipant!
.publishVideoTrack(video.track as LocalVideoTrack);
_localParticipant!.publishVideoTrack(video.track as LocalVideoTrack,
publishOptions: roomOptions.defaultVideoPublishOptions);
} else {
_localParticipant!.setCameraEnabled(true);
_localParticipant!.setCameraEnabled(true,
cameraCaptureOptions: roomOptions.defaultCameraCaptureOptions);
}
}

var screen = options.screen;
if (screen.enabled != null && screen.enabled == true) {
if (screen.track != null) {
_localParticipant!
.publishVideoTrack(screen.track as LocalVideoTrack);
_localParticipant!.publishVideoTrack(
screen.track as LocalVideoTrack,
publishOptions: roomOptions.defaultVideoPublishOptions);
} else {
_localParticipant!.setScreenShareEnabled(true);
_localParticipant!.setScreenShareEnabled(true,
screenShareCaptureOptions:
roomOptions.defaultScreenShareCaptureOptions);
}
}
}
Expand Down

0 comments on commit 03a7672

Please sign in to comment.