Committed by
GitHub
Fix setScreenShareEnabled not starting the screen share track (#435)
* Fix setScreenShareEnabled not starting the screen share track * Increase build memory size
正在显示
3 个修改的文件
包含
6 行增加
和
12 行删除
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html | 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html |
| 7 | # Specifies the JVM arguments used for the daemon process. | 7 | # Specifies the JVM arguments used for the daemon process. |
| 8 | # The setting is particularly useful for tweaking memory settings. | 8 | # The setting is particularly useful for tweaking memory settings. |
| 9 | -org.gradle.jvmargs=-Xmx1536m | 9 | +org.gradle.jvmargs=-Xmx4g |
| 10 | # When configured, Gradle will run in incubating parallel mode. | 10 | # When configured, Gradle will run in incubating parallel mode. |
| 11 | # This option should only be used with decoupled projects. More details, visit | 11 | # This option should only be used with decoupled projects. More details, visit |
| 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects |
| @@ -250,6 +250,8 @@ internal constructor( | @@ -250,6 +250,8 @@ internal constructor( | ||
| 250 | } | 250 | } |
| 251 | val track = | 251 | val track = |
| 252 | createScreencastTrack(mediaProjectionPermissionResultData = mediaProjectionPermissionResultData) | 252 | createScreencastTrack(mediaProjectionPermissionResultData = mediaProjectionPermissionResultData) |
| 253 | + track.startForegroundService(null, null) | ||
| 254 | + track.startCapture() | ||
| 253 | publishVideoTrack(track) | 255 | publishVideoTrack(track) |
| 254 | } | 256 | } |
| 255 | 257 |
| @@ -308,18 +308,10 @@ class CallViewModel( | @@ -308,18 +308,10 @@ class CallViewModel( | ||
| 308 | fun startScreenCapture(mediaProjectionPermissionResultData: Intent) { | 308 | fun startScreenCapture(mediaProjectionPermissionResultData: Intent) { |
| 309 | val localParticipant = room.localParticipant | 309 | val localParticipant = room.localParticipant |
| 310 | viewModelScope.launch { | 310 | viewModelScope.launch { |
| 311 | - val screencastTrack = | ||
| 312 | - localParticipant.createScreencastTrack(mediaProjectionPermissionResultData = mediaProjectionPermissionResultData) | ||
| 313 | - localParticipant.publishVideoTrack( | ||
| 314 | - screencastTrack, | ||
| 315 | - ) | ||
| 316 | - | ||
| 317 | - // Must start the foreground prior to startCapture. | ||
| 318 | - screencastTrack.startForegroundService(null, null) | ||
| 319 | - screencastTrack.startCapture() | ||
| 320 | - | 311 | + localParticipant.setScreenShareEnabled(true, mediaProjectionPermissionResultData) |
| 312 | + val screencastTrack = localParticipant.getTrackPublication(Track.Source.SCREEN_SHARE)?.track as? LocalScreencastVideoTrack | ||
| 321 | this@CallViewModel.localScreencastTrack = screencastTrack | 313 | this@CallViewModel.localScreencastTrack = screencastTrack |
| 322 | - mutableScreencastEnabled.postValue(screencastTrack.enabled) | 314 | + mutableScreencastEnabled.postValue(screencastTrack?.enabled) |
| 323 | } | 315 | } |
| 324 | } | 316 | } |
| 325 | 317 |
-
请 注册 或 登录 后发表评论