@@ -233,8 +233,6 @@ public void init(String url, String streamId, String mode, String token, Intent
233233
234234 iceServers .add (new PeerConnection .IceServer (stunServerUri ));
235235
236-
237-
238236 if (remoteRendererList != null ) {
239237 int size = remoteRendererList .size ();
240238 for (int i = 0 ; i < size ; i ++)
@@ -495,6 +493,21 @@ public void startScreenCapture() {
495493 }
496494 }
497495
496+ @ TargetApi (21 )
497+ private @ Nullable VideoCapturer createScreenCapturer () {
498+ if (mediaProjectionPermissionResultCode != Activity .RESULT_OK ) {
499+ reportError ("User didn't give permission to capture the screen." );
500+ return null ;
501+ }
502+ return new ScreenCapturerAndroid (mediaProjection ,
503+ mediaProjectionPermissionResultData , new MediaProjection .Callback () {
504+ @ Override
505+ public void onStop () {
506+ reportError ("User revoked permission to capture the screen." );
507+ }
508+ });
509+ }
510+
498511
499512 public void onActivityResult (int requestCode , int resultCode , Intent data ) {
500513 if (requestCode != CallActivity .CAPTURE_PERMISSION_REQUEST_CODE )
@@ -566,21 +579,6 @@ public void setOpenFrontCamera(boolean openFrontCamera) {
566579 return null ;
567580 }
568581
569- @ TargetApi (21 )
570- private @ Nullable VideoCapturer createScreenCapturer () {
571- if (mediaProjectionPermissionResultCode != Activity .RESULT_OK ) {
572- reportError ("User didn't give permission to capture the screen." );
573- return null ;
574- }
575- return new ScreenCapturerAndroid (mediaProjection ,
576- mediaProjectionPermissionResultData , new MediaProjection .Callback () {
577- @ Override
578- public void onStop () {
579- reportError ("User revoked permission to capture the screen." );
580- }
581- });
582- }
583-
584582 @ Override
585583 public void stopVideoSource () {
586584 activityRunning = false ;
@@ -851,8 +849,6 @@ public void changeVideoSource(String newSource) {
851849 } else if (SOURCE_REAR .equals (source )) {
852850 openFrontCamera = false ;
853851 }
854-
855-
856852 if (source .equals (SOURCE_FILE )) {
857853 String videoFileAsCamera = this .intent .getStringExtra (CallActivity .EXTRA_VIDEO_FILE_AS_CAMERA );
858854 try {
0 commit comments