Skip to content

Commit 261b6fc

Browse files
author
xianing
committed
fix regression issues
1 parent f496327 commit 261b6fc

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import com.yanzhenjie.permission.AndPermission;
2323
import com.yanzhenjie.permission.runtime.Permission;
2424

25+
import java.text.SimpleDateFormat;
26+
2527
import io.agora.api.component.Constant;
2628
import io.agora.api.example.R;
2729
import io.agora.api.example.annotation.Example;
@@ -200,6 +202,7 @@ public void onDestroy()
200202
/**leaveChannel and Destroy the RtcEngine instance*/
201203
if(engine != null)
202204
{
205+
stopProgressTimer();
203206
engine.leaveChannel();
204207
}
205208
handler.post(RtcEngine::destroy);
@@ -267,11 +270,12 @@ else if(v.getId() == R.id.bgmStart)
267270
{
268271
sliderSpeed.setProgress(50);
269272
engine.startAudioMixing(currentMusic, false, false, -1, 0);
270-
engine.getAudioFileInfo(currentMusic);
271273
startProgressTimer();
272274
}
273275
else if(v.getId() == R.id.bgmStop){
274276
engine.stopAudioMixing();
277+
progressText.setText("00:00");
278+
mixingProgressBar.setProgress(0);
275279
stopProgressTimer();
276280
}
277281
else if(v.getId() == R.id.bgmResume){
@@ -327,7 +331,9 @@ private void stopProgressTimer() {
327331
}
328332

329333
private void startProgressTimer() {
330-
final int result = (int) ((float) engine.getAudioMixingCurrentPosition() / (float) engine.getAudioFileInfo(Constant.URL_PLAY_AUDIO_FILES) * 100);
334+
String timeString = new SimpleDateFormat("mm:ss").format(engine.getAudioMixingDuration());
335+
progressText.setText(timeString);
336+
final int result = (int) ((float) engine.getAudioMixingCurrentPosition() / (float) engine.getAudioMixingDuration() * 100);
331337
mixingProgressBar.setProgress(Long.valueOf(result).intValue());
332338
handler.postDelayed(this::startProgressTimer, 500);
333339
}

macOS/APIExample/Examples/Advanced/CustomAudioRender/CustomAudioRender.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ class CustomAudioRender: BaseViewController {
157157
agoraKit.disableVideo()
158158

159159
// set proxy configuration
160-
let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value
161-
agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy)
160+
// let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value
161+
// agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy)
162162

163163
// set live broadcaster mode
164164
agoraKit.setChannelProfile(.liveBroadcasting)
@@ -167,10 +167,8 @@ class CustomAudioRender: BaseViewController {
167167

168168
// setup external audio source
169169
exAudio.setupExternalAudio(withAgoraKit: agoraKit, sampleRate: UInt32(sampleRate), channels: UInt32(audioChannel), audioCRMode: .sdkCaptureExterRender, ioType: .remoteIO)
170-
// important!! this example is using onPlaybackAudioFrame to do custom rendering
171-
// by default the audio output will still be processed by SDK hence below api call is mandatory to disable that behavior
172-
agoraKit.setParameters("{\"che.audio.external_render\": true}")
173-
agoraKit.setParameters("{\"che.audio.keep.audiosession\": true}")
170+
171+
agoraKit.enableExternalAudioSink(sampleRate, channels: audioChannel)
174172

175173
// start joining channel
176174
// 1. Users can only see each other after they join the

0 commit comments

Comments
 (0)