davidliu
Committed by GitHub

Fix setScreenShareEnabled not starting the screen share track (#435)

* Fix setScreenShareEnabled not starting the screen share track

* Increase build memory size
... ... @@ -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
... ...
... ... @@ -250,6 +250,8 @@ internal constructor(
}
val track =
createScreencastTrack(mediaProjectionPermissionResultData = mediaProjectionPermissionResultData)
track.startForegroundService(null, null)
track.startCapture()
publishVideoTrack(track)
}
... ...
... ... @@ -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)
}
}
... ...