Skip to content

Commit 2e9540b

Browse files
author
Arlin
committed
[iOS] Update FusionCDN API of RTMPStreaming
1 parent 9ac5816 commit 2e9540b

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

iOS/APIExample/Examples/Advanced/ContentInspect/ContentInspect.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ class ContentInspectViewController: BaseViewController {
2727
// MARK: - LifeCycle
2828
override func viewDidLoad() {
2929
super.viewDidLoad()
30-
self.setupUI()
30+
setupUI()
3131

3232
guard let channelId = configs["channelName"] as? String else {return}
3333

3434
agoraKit = AgoraRtcEngineKit.sharedEngine(withAppId: KeyCenter.AppId, delegate: self)
3535
agoraKit.enableVideo()
3636

3737
let videoCanvas = AgoraRtcVideoCanvas()
38-
videoCanvas.view = self.localVideoView
38+
videoCanvas.view = localVideoView
3939
videoCanvas.renderMode = .hidden
4040
agoraKit.setupLocalVideo(videoCanvas)
4141

@@ -55,7 +55,7 @@ class ContentInspectViewController: BaseViewController {
5555
let result = agoraKit.joinChannel(byToken: KeyCenter.Token, channelId: channelId, uid: 0, mediaOptions: options)
5656
if result != 0 {
5757
/// Error code description: https://docs.agora.io/en/Interactive%20Broadcast/error_rtc
58-
self.showAlert(title: "Error", message: "Join channel failed with errorCode: \(result)")
58+
showAlert(title: "Error", message: "Join channel failed with errorCode: \(result)")
5959
}
6060
}
6161

@@ -102,7 +102,7 @@ extension ContentInspectViewController: AgoraRtcEngineDelegate {
102102
func rtcEngine(_ engine: AgoraRtcEngineKit, didOccurError errorCode: AgoraErrorCode) {
103103
/// Error code description: https://docs.agora.io/en/Interactive%20Broadcast/error_rtc
104104
LogUtils.log(message: "Error occur: \(errorCode)", level: .error)
105-
self.showAlert(title: "Error", message: "Error: \(errorCode.description)")
105+
showAlert(title: "Error", message: "Error: \(errorCode.description)")
106106
}
107107

108108
func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinChannel channel: String, withUid uid: UInt, elapsed: Int) {

iOS/APIExample/Examples/Advanced/FusionCDN/FusionCDN.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class FusionCDNHost: BaseViewController {
179179

180180
@IBAction func setStreaming(sender: AGButton) {
181181
if rtcStreaming{
182-
agoraKit.removePublishStreamUrl(streamingUrl)
182+
agoraKit.stopRtmpStream(streamingUrl)
183183
agoraKit.leaveChannel(nil)
184184
stopStreaming()
185185
}
@@ -217,7 +217,7 @@ class FusionCDNHost: BaseViewController {
217217
agoraKit.stopDirectCdnStreaming()
218218
}
219219
else {
220-
agoraKit.removePublishStreamUrl(streamingUrl)
220+
agoraKit.stopRtmpStream(streamingUrl)
221221
}
222222
}
223223

@@ -252,7 +252,7 @@ class FusionCDNHost: BaseViewController {
252252
LogUtils.log(message: "igored user \(view.uid) as only 2x2 video layout supported in this demo.", level: .warning)
253253
}
254254
}
255-
agoraKit.setLiveTranscoding(transcoding)
255+
agoraKit.updateRtmpTranscoding(transcoding)
256256
}
257257

258258
override func willMove(toParent parent: UIViewController?) {
@@ -472,8 +472,7 @@ extension FusionCDNHost: AgoraDirectCdnStreamingEventDelegate {
472472
// cn: https://docs.agora.io/cn/Voice/API%20Reference/oc/Constants/AgoraErrorCode.html
473473
self.showAlert(title: "Error", message: "joinChannel call failed: \(result), please check your params")
474474
}
475-
agoraKit.setLiveTranscoding(transcoding)
476-
agoraKit.addPublishStreamUrl(streamingUrl, transcodingEnabled: true)
475+
agoraKit.startRtmpStream(withTranscoding: streamingUrl, transcoding: transcoding)
477476
}
478477
else{
479478
self.streamingButton.setTitle("Start Live Streaming", for: .normal)
@@ -510,7 +509,7 @@ extension FusionCDNHost: AgoraRtcEngineDelegate {
510509
user.uid = uid
511510
agoraKit.startPreview()
512511
transcoding.add(user)
513-
engine.setLiveTranscoding(transcoding)
512+
agoraKit.updateRtmpTranscoding(transcoding)
514513
}
515514

516515
/// callback when a remote user is joinning the channel, note audience in live broadcast mode will NOT trigger this event

0 commit comments

Comments
 (0)