Skip to content

Commit 7cc49e6

Browse files
author
xianing
committed
adapt latest 3.4.5 api
1 parent d50595c commit 7cc49e6

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ public boolean onPlaybackFrameBeforeMixingEx(AudioFrame audioFrame, int uid, Str
404404
}
405405

406406
@Override
407-
public int getObservedFramePosition() {
407+
public int getObservedAudioFramePosition() {
408408
return 0;
409409
}
410410

iOS/APIExample/Examples/Advanced/RawAudioData/RawAudioData.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class RawAudioDataMain: BaseViewController {
6868
agoraKit.setChannelProfile(.liveBroadcasting)
6969
agoraKit.setClientRole(.broadcaster)
7070
// Register audio observer
71-
agoraKit.setAudioFrameDelegate(self)
71+
agoraKit.setAudioDataFrame(self)
7272

7373
agoraKit.setRecordingAudioFrameParametersWithSampleRate(44100, channel: 1, mode: .readWrite, samplesPerCall: 4410)
7474
agoraKit.setMixedAudioFrameParametersWithSampleRate(44100, samplesPerCall: 4410)
@@ -109,7 +109,7 @@ class RawAudioDataMain: BaseViewController {
109109
// deregister observers
110110
agoraKit.leaveChannel { (stats) -> Void in
111111
// unregister AudioFrameDelegate
112-
self.agoraKit.setAudioFrameDelegate(nil)
112+
self.agoraKit.setAudioDataFrame(nil)
113113
LogUtils.log(message: "left channel, duration: \(stats.duration)", level: .info)
114114
}
115115
}
@@ -212,7 +212,11 @@ extension RawAudioDataMain: AgoraRtcEngineDelegate {
212212

213213
// audio data plugin, here you can process raw audio data
214214
// note this all happens in CPU so it comes with a performance cost
215-
extension RawAudioDataMain: AgoraAudioFrameDelegate{
215+
extension RawAudioDataMain: AgoraAudioDataFrameProtocol{
216+
func getObservedAudioFramePosition() -> AgoraAudioFramePosition {
217+
return .record
218+
}
219+
216220
func onRecord(_ frame: AgoraAudioFrame) -> Bool {
217221
return true
218222
}

macOS/APIExample/Examples/Advanced/RawAudioData/RawAudioData.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class RawAudioData: BaseViewController {
134134
if isJoined {
135135
agoraKit.leaveChannel { (stats:AgoraChannelStats) in
136136
// unregister AudioFrameDelegate
137-
self.agoraKit.setAudioFrameDelegate(nil)
137+
self.agoraKit.setAudioDataFrame(nil)
138138
LogUtils.log(message: "Left channel", level: .info)
139139
}
140140
}
@@ -166,7 +166,7 @@ class RawAudioData: BaseViewController {
166166
agoraKit.setMixedAudioFrameParametersWithSampleRate(44100, samplesPerCall: 4410)
167167
agoraKit.setPlaybackAudioFrameParametersWithSampleRate(44100, channel: 1, mode: .readWrite, samplesPerCall: 4410)
168168
// Register audio observer
169-
agoraKit.setAudioFrameDelegate(self)
169+
agoraKit.setAudioDataFrame(self)
170170
// set up local video to render your local camera preview
171171
let localVideo = videos[0]
172172
let videoCanvas = AgoraRtcVideoCanvas()
@@ -308,7 +308,11 @@ extension RawAudioData: AgoraRtcEngineDelegate {
308308

309309
// audio data plugin, here you can process raw audio data
310310
// note this all happens in CPU so it comes with a performance cost
311-
extension RawAudioData: AgoraAudioFrameDelegate{
311+
extension RawAudioData: AgoraAudioDataFrameProtocol{
312+
func getObservedAudioFramePosition() -> AgoraAudioFramePosition {
313+
return .record
314+
}
315+
312316
func onRecord(_ frame: AgoraAudioFrame) -> Bool {
313317
return true
314318
}

0 commit comments

Comments
 (0)