@@ -245,6 +245,8 @@ public void onNothingSelected(AdapterView<?> parent) {
245245
246246 mRootBinding .spinnerScenario .setOnItemSelectedListener (this );
247247 mRootBinding .spinnerSnapshot .setOnItemSelectedListener (this );
248+
249+ mRootBinding .btnLocalScreenshot .setEnabled (false );
248250 }
249251
250252 private void resetFps () {
@@ -388,6 +390,7 @@ public void onPermissionsResult(boolean allPermissionsGranted, String[] permissi
388390 }
389391 });
390392 } else {
393+ mRootBinding .btnLocalScreenshot .setEnabled (false );
391394 joined = false ;
392395 mRootBinding .llContainerFp .setVisibility (View .GONE );
393396 isHost = false ;
@@ -638,7 +641,7 @@ private void takeSnapshot(int uid) {
638641 showLongToast (getString (R .string .join_channel_first ));
639642 return ;
640643 }
641- String filePath = requireContext ().getExternalCacheDir (). getAbsolutePath () + "_livestreaming_snapshot.png" ;
644+ String filePath = new File ( requireContext ().getExternalCacheDir (), uid + "_livestreaming_snapshot.png" ). getAbsolutePath () ;
642645 SnapshotConfig config = new SnapshotConfig ();
643646 config .filePath = filePath ;
644647 if (uid == myUid ) {
@@ -647,7 +650,7 @@ private void takeSnapshot(int uid) {
647650 if (ret != Constants .ERR_OK ) {
648651 showLongToast ("takeSnapshot local error code=" + ret + ",msg=" + RtcEngine .getErrorDescription (ret ));
649652 }
650- }else {
653+ } else {
651654 if (uid != 0 ) {
652655// config.position = Constants.VideoModulePosition.VIDEO_MODULE_POSITION_PRE_RENDERER;
653656// int ret = engine.takeSnapshot(uid, config);
@@ -847,6 +850,11 @@ public void onClientRoleChanged(int oldRole, int newRole, ClientRoleOptions newR
847850 Log .i (TAG , String .format ("client role changed from state %d to %d" , oldRole , newRole ));
848851 runOnUIThread (() -> {
849852 mRootBinding .btnPublish .setEnabled (true );
853+ if (newRole == Constants .CLIENT_ROLE_BROADCASTER ) {
854+ mRootBinding .btnLocalScreenshot .setEnabled (true );
855+ } else {
856+ mRootBinding .btnLocalScreenshot .setEnabled (false );
857+ }
850858 });
851859 }
852860
0 commit comments