@@ -50,7 +50,7 @@ public class SuperResolution extends BaseFragment implements View.OnClickListene
5050 private static final String TAG = SuperResolution .class .getSimpleName ();
5151
5252 private FrameLayout fl_local , fl_remote ;
53- private Button join , btnSuperResolution ;
53+ private Button join , btnSuperResolution , switchCamera ;
5454 private EditText et_channel ;
5555 private RtcEngine engine ;
5656 private int myUid ;
@@ -73,9 +73,12 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
7373 join = view .findViewById (R .id .btn_join );
7474 btnSuperResolution = view .findViewById (R .id .btn_super_resolution );
7575 btnSuperResolution .setEnabled (false );
76+ switchCamera = view .findViewById (R .id .btn_switch );
77+ switchCamera .setEnabled (false );
7678 et_channel = view .findViewById (R .id .et_channel );
7779 view .findViewById (R .id .btn_join ).setOnClickListener (this );
7880 view .findViewById (R .id .btn_super_resolution ).setOnClickListener (this );
81+ view .findViewById (R .id .btn_switch ).setOnClickListener (this );
7982 fl_local = view .findViewById (R .id .fl_local );
8083 fl_remote = view .findViewById (R .id .fl_remote );
8184 }
@@ -172,7 +175,13 @@ public void onClick(View v)
172175 }
173176 }
174177 else if (v .getId () == R .id .btn_super_resolution ){
175- engine .enableRemoteSuperResolution (remoteUid , !enableSuperResolution );
178+ int ret = engine .enableRemoteSuperResolution (remoteUid , !enableSuperResolution );
179+ if (ret !=0 ){
180+ Log .w (TAG , String .format ("onWarning code %d " , ret ));
181+ }
182+ }
183+ else if (v .getId () == R .id .btn_switch ){
184+ engine .switchCamera ();
176185 }
177186 }
178187
@@ -259,6 +268,7 @@ private void joinChannel(String channelId)
259268 public void onWarning (int warn )
260269 {
261270 Log .w (TAG , String .format ("onWarning code %d message %s" , warn , RtcEngine .getErrorDescription (warn )));
271+ showAlert (String .format ("onWarning code %d message %s" , warn , RtcEngine .getErrorDescription (warn )));
262272 }
263273
264274 /**Reports an error during SDK runtime.
@@ -421,6 +431,7 @@ public void onUserJoined(int uid, int elapsed)
421431 engine .setupRemoteVideo (new VideoCanvas (surfaceView , RENDER_MODE_HIDDEN , uid ));
422432 remoteUid = uid ;
423433 btnSuperResolution .setEnabled (true );
434+ switchCamera .setEnabled (true );
424435 });
425436 }
426437
@@ -447,6 +458,7 @@ public void run() {
447458 remove the SurfaceView from its parent*/
448459 engine .setupRemoteVideo (new VideoCanvas (null , RENDER_MODE_HIDDEN , uid ));
449460 btnSuperResolution .setEnabled (false );
461+ switchCamera .setEnabled (false );
450462 }
451463 });
452464 }
0 commit comments