@@ -118,16 +118,18 @@ class MediaProjectionService :
118118 launch {
119119 mixer.attachAudio(0 , AudioRecordSource (applicationContext))
120120 intent?.getParcelableExtra<Intent >(EXTRA_RESULT_DATA )?.let {
121- val source =
122- MediaProjectionSource (
123- applicationContext,
124- mediaProjectionManager.getMediaProjection(Activity .RESULT_OK , it),
125- )
126- mixer.attachVideo(0 , source).onSuccess {
127- Log .i(TAG , " ${source.video.videoSize} " )
128- mixer.screen.frame =
129- Rect (0 , 0 , source.video.videoSize.width, source.video.videoSize.height)
130- session.connect(StreamSession .Method .INGEST )
121+ mediaProjectionManager.getMediaProjection(Activity .RESULT_OK , it)?.let {
122+ val source =
123+ MediaProjectionSource (
124+ applicationContext,
125+ it,
126+ )
127+ mixer.attachVideo(0 , source).onSuccess {
128+ Log .i(TAG , " ${source.video.videoSize} " )
129+ mixer.screen.frame =
130+ Rect (0 , 0 , source.video.videoSize.width, source.video.videoSize.height)
131+ session.connect(StreamSession .Method .INGEST )
132+ }
131133 }
132134 }
133135 }
@@ -178,6 +180,7 @@ class MediaProjectionService :
178180 return this
179181 }
180182
181- fun isRunning (context : Context ): Boolean = LocalBroadcastManager .getInstance(context).sendBroadcast(Intent (ACTION_SERVICE_RUNNING ))
183+ fun isRunning (context : Context ): Boolean =
184+ LocalBroadcastManager .getInstance(context).sendBroadcast(Intent (ACTION_SERVICE_RUNNING ))
182185 }
183186}
0 commit comments