iOS/APIExample/APIExample/Examples/Basic/JoinChannelVideo/SKILL.md
Guide for implementing video call functionality in business scenarios, including SDK initialization, joining channels, video encoding configuration, and event handling
npx skillsauth add agoraio/api-examples join-channel-video-guideInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This example demonstrates how to use Agora RTC SDK to implement basic video call functionality, including:
let config = AgoraRtcEngineConfig()
config.appId = KeyCenter.AppId
config.areaCode = GlobalSettings.shared.area
config.channelProfile = .liveBroadcasting
agoraKit = AgoraRtcEngineKit.sharedEngine(with: config, delegate: self)
Key Parameters:
appId: App ID obtained from Agora ConsoleareaCode: Region code for specifying connection regionchannelProfile: Channel profile, .liveBroadcasting supports host and audience rolesagoraKit.setClientRole(.broadcaster) // or .audience
agoraKit.enableVideo()
agoraKit.enableAudio()
agoraKit.setVideoEncoderConfiguration(
AgoraVideoEncoderConfiguration(
size: CGSize(width: 960, height: 540),
frameRate: .fps15,
bitrate: AgoraVideoBitrateStandard,
orientationMode: .adaptative,
mirrorMode: .auto
)
)
Configurable Parameters:
size: Video resolution (90x90 ~ 1280x720)frameRate: Frame rate (10/15/24/30/60 fps)orientationMode: Video orientation mode
.adaptative: Adaptive.fixedLandscape: Fixed landscape.fixedPortrait: Fixed portraitlet videoCanvas = AgoraRtcVideoCanvas()
videoCanvas.uid = 0 // Local user uid is 0
videoCanvas.view = localVideoView
videoCanvas.renderMode = .hidden
agoraKit.setupLocalVideo(videoCanvas)
agoraKit.startPreview()
let option = AgoraRtcChannelMediaOptions()
option.publishCameraTrack = true
option.publishMicrophoneTrack = true
option.clientRoleType = .broadcaster
agoraKit.joinChannel(
byToken: token,
channelId: channelName,
uid: 0, // 0 means SDK automatically assigns uid
mediaOptions: option
)
Important Notes:
Set in didJoinedOfUid callback:
func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinedOfUid uid: UInt, elapsed: Int) {
let videoCanvas = AgoraRtcVideoCanvas()
videoCanvas.uid = uid
videoCanvas.view = remoteVideoView
videoCanvas.renderMode = .hidden
agoraKit.setupRemoteVideo(videoCanvas)
}
agoraKit.disableAudio()
agoraKit.disableVideo()
agoraKit.stopPreview()
agoraKit.leaveChannel { stats in
print("left channel, duration: \(stats.duration)")
}
func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinChannel channel: String, withUid uid: UInt, elapsed: Int)
Triggered when local user successfully joins channel.
func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinedOfUid uid: UInt, elapsed: Int)
Triggered when remote user joins channel (not triggered for audience role).
func rtcEngine(_ engine: AgoraRtcEngineKit, didOfflineOfUid uid: UInt, reason: AgoraUserOfflineReason)
Triggered when remote user leaves channel.
func rtcEngine(_ engine: AgoraRtcEngineKit, didOccurError errorCode: AgoraErrorCode)
Triggered when SDK encounters an error, recommend displaying error message to user.
A: Check if startPreview() and setupLocalVideo() have been called
A:
setupRemoteVideo() is correctly set in didJoinedOfUid callbackoption.publishCameraTrack = trueA:
A: Call agoraKit.switchCamera()
A:
agoraKit.muteLocalAudioStream(true/false)agoraKit.muteRemoteAudioStream(uid, mute: true/false)A:
agoraKit.muteLocalVideoStream(true/false)agoraKit.muteRemoteVideoStream(uid, mute: true/false)JoinChannelAudio - Audio-only callJoinChannelVideoToken - Join channel with TokenVideoProcess - Video processing (filters, watermarks)CustomVideoSourcePush - Custom video sourcedevelopment
Add a new API example or modify an existing one. Covers both creation and modification scenarios, including dialog class structure, message map registration, and ARCHITECTURE.md updates.
development
Code review for API examples. Ensures examples follow project conventions, handle lifecycle correctly, manage threads safely, and use APIs properly.
development
Add a new API example or modify an existing one. Covers both creation and modification scenarios, including file structure, registration, and ARCHITECTURE.md updates.
development
Code review for API examples. Ensures examples follow project conventions, handle lifecycle correctly, manage threads safely, and use APIs properly.