@@ -192,7 +192,8 @@ public void onClick(View v)
192192 * triggers the removeInjectStreamUrl method.*/
193193 engine .leaveChannel ();
194194 join .setText (getString (R .string .join ));
195- mSSClient .stop (getContext ());
195+ if (isSharing )
196+ mSSClient .stop (getContext ());
196197 screenShare .setText (getResources ().getString (R .string .screenshare ));
197198 screenShare .setEnabled (false );
198199 isSharing = false ;
@@ -244,9 +245,6 @@ private void joinChannel(String channelId)
244245 fl_local .addView (surfaceView , new FrameLayout .LayoutParams (ViewGroup .LayoutParams .MATCH_PARENT , ViewGroup .LayoutParams .MATCH_PARENT ));
245246 // Setup local video to render your local camera preview
246247 engine .setupLocalVideo (new VideoCanvas (surfaceView , RENDER_MODE_HIDDEN , 0 ));
247- // Set audio route to microPhone
248- engine .disableAudio ();
249- // engine.setDefaultAudioRoutetoSpeakerphone(false);
250248
251249 /** Sets the channel profile of the Agora RtcEngine.
252250 CHANNEL_PROFILE_COMMUNICATION(0): (Default) The Communication profile.
@@ -281,8 +279,8 @@ private void joinChannel(String channelId)
281279 if you do not specify the uid, we will generate the uid for you*/
282280
283281 ChannelMediaOptions option = new ChannelMediaOptions ();
284- option .autoSubscribeAudio = false ;
285- option .autoSubscribeVideo = false ;
282+ option .autoSubscribeAudio = true ;
283+ option .autoSubscribeVideo = true ;
286284 int res = engine .joinChannel (accessToken , channelId , "Extra Optional Data" , 0 , option );
287285 if (res != 0 )
288286 {
0 commit comments