Skip to content

Commit

Permalink
Fix setScreenShareEnabled not starting the screen share track (#435)
Browse files Browse the repository at this point in the history
* Fix setScreenShareEnabled not starting the screen share track

* Increase build memory size
  • Loading branch information
davidliu authored Jun 14, 2024
1 parent 21d1508 commit c0058a2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
org.gradle.jvmargs=-Xmx4g
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ internal constructor(
}
val track =
createScreencastTrack(mediaProjectionPermissionResultData = mediaProjectionPermissionResultData)
track.startForegroundService(null, null)
track.startCapture()
publishVideoTrack(track)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,18 +308,10 @@ class CallViewModel(
fun startScreenCapture(mediaProjectionPermissionResultData: Intent) {
val localParticipant = room.localParticipant
viewModelScope.launch {
val screencastTrack =
localParticipant.createScreencastTrack(mediaProjectionPermissionResultData = mediaProjectionPermissionResultData)
localParticipant.publishVideoTrack(
screencastTrack,
)

// Must start the foreground prior to startCapture.
screencastTrack.startForegroundService(null, null)
screencastTrack.startCapture()

localParticipant.setScreenShareEnabled(true, mediaProjectionPermissionResultData)
val screencastTrack = localParticipant.getTrackPublication(Track.Source.SCREEN_SHARE)?.track as? LocalScreencastVideoTrack
this@CallViewModel.localScreencastTrack = screencastTrack
mutableScreencastEnabled.postValue(screencastTrack.enabled)
mutableScreencastEnabled.postValue(screencastTrack?.enabled)
}
}

Expand Down

0 comments on commit c0058a2

Please sign in to comment.