Skip to content

Commit 3fd4449

Browse files
committed
[BGF] For MultiProcess.java enable audio&video feature, fix a crash when Join then Leave channel.
1 parent dde0daf commit 3fd4449

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/MultiProcess.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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
{

Android/APIExample/lib-screensharing/src/main/java/io/agora/rtc/ss/ScreenSharingClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static ScreenSharingClient getInstance() {
3535
return mInstance;
3636
}
3737

38-
private ServiceConnection mScreenShareConn = new ServiceConnection() {
38+
private final ServiceConnection mScreenShareConn = new ServiceConnection() {
3939
public void onServiceConnected(ComponentName className, IBinder service) {
4040
mScreenShareSvc = IScreenSharing.Stub.asInterface(service);
4141

@@ -54,7 +54,7 @@ public void onServiceDisconnected(ComponentName className) {
5454
}
5555
};
5656

57-
private INotification mNotification = new INotification.Stub() {
57+
private final INotification mNotification = new INotification.Stub() {
5858
/**
5959
* This is called by the remote service to tell us about error happened.
6060
* Note that IPC calls are dispatched through a thread

0 commit comments

Comments
 (0)