Skip to content

Commit 6ca8817

Browse files
author
xia ning
authored
Merge pull request #232 from AgoraIO/dev/fixbug
fix regression issues
2 parents f496327 + 3998533 commit 6ca8817

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,19 @@ else if (v.getId() == R.id.btn_effect)
323323
}
324324

325325
private void stopProgressTimer() {
326+
mixingProgressBar.setProgress(0);
326327
handler.removeCallbacksAndMessages(null);
327328
}
328329

329330
private void startProgressTimer() {
330-
final int result = (int) ((float) engine.getAudioMixingCurrentPosition() / (float) engine.getAudioFileInfo(Constant.URL_PLAY_AUDIO_FILES) * 100);
331-
mixingProgressBar.setProgress(Long.valueOf(result).intValue());
332-
handler.postDelayed(this::startProgressTimer, 500);
331+
if(engine != null) {
332+
int currentPosition = engine.getAudioMixingCurrentPosition();
333+
if (mixingProgressBar.getMax() != 0 && !mixingProgressBar.isPressed())
334+
mixingProgressBar.setProgress(currentPosition);
335+
handler.postDelayed(this::startProgressTimer, 1000);
336+
}
333337
}
338+
334339
/**
335340
* @param channelId Specify the channel name that you want to join.
336341
* Users that input the same channel name join the same channel.*/

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)