Skip to content

Commit

Permalink
Merge pull request #58 from BoleLiu/dev
Browse files Browse the repository at this point in the history
Added comment for job switching
  • Loading branch information
OurEra authored Mar 8, 2021
2 parents d0600c5 + 59aacc9 commit 4149c26
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public class RoomActivity extends Activity implements QNRTCEngineEventListener,
public static final String EXTRA_ROOM_TOKEN = "ROOM_TOKEN";
public static final String EXTRA_ROOM_ID = "ROOM_ID";

private static final int JOB_STOP_DELAY_TIME = 5000;

private static final String[] MANDATORY_PERMISSIONS = {
"android.permission.MODIFY_AUDIO_SETTINGS",
"android.permission.RECORD_AUDIO",
Expand Down Expand Up @@ -1006,7 +1008,13 @@ public void onCreateMergeJobSuccess(String mergeJobId) {

// 取消单路转推
if (mIsForwardJobStreaming) {
mEngine.stopForwardJob(mForwardJob.getForwardJobId());
// 注意:
// 1. A 房间中创建的转推任务,只能在 A 房间中进行销毁,无法在其他房间中销毁
// 2. JOB_STOP_DELAY_TIME 代表转推任务延迟关闭的时间,如果您的场景涉及到房间的切换以及不同转推任务
// 的切换,为了保证切换场景下播放的连续性,建议您务必添加延迟关闭时间;
// 3. 如果您的业务场景不涉及到跨房间的转推任务切换,可以不用设置延迟关闭时间,直接调用
// mEngine.stopForwardJob(mForwardJob.getForwardJobId()) 即可,SDK 默认会立即停止转推任务
mEngine.stopForwardJob(mForwardJob.getForwardJobId(), JOB_STOP_DELAY_TIME);
mIsForwardJobStreaming = false;
mControlFragment.updateForwardJobText(getString(R.string.forward_job_btn_text));
}
Expand All @@ -1026,7 +1034,13 @@ public void onCreateForwardJobSuccess(String forwardJobId) {

// 取消合流转推
if (mIsMergeJobStreaming && mCurrentMergeJob != null) {
mEngine.stopMergeStream(mCurrentMergeJob.getMergeJobId());
// 注意:
// 1. A 房间中创建的转推任务,只能在 A 房间中进行销毁,无法在其他房间中销毁
// 2. JOB_STOP_DELAY_TIME 代表转推任务延迟关闭的时间,如果您的场景涉及到房间的切换以及不同转推任务
// 的切换,为了保证切换场景下播放的连续性,建议您务必添加延迟关闭时间;
// 3. 如果您的业务场景不涉及到跨房间的转推任务切换,可以不用设置延迟关闭时间,直接调用
// mEngine.stopForwardJob(mForwardJob.getForwardJobId()) 即可,SDK 默认会立即停止转推任务
mEngine.stopMergeStream(mCurrentMergeJob.getMergeJobId(), JOB_STOP_DELAY_TIME);
mIsMergeJobStreaming = false;
mMergeLayoutConfigView.updateStreamingStatus(false);
}
Expand Down

0 comments on commit 4149c26

Please sign in to comment.