iOS Core SDK Quickstart
This quickstart shows how to use Dyte's iOS Core SDK to add live video and audio to your iOS applications.
For getting started quickly, you can use our sample code. You can clone and run a sample application from the iOS Core SDK GitHub repository.
Objective
You’ll learn how to:
- Install the Dyte SDK
- Initialize the SDK
- Configure a Dyte meeting
- Initialize the Dyte meeting
- Go live with your Dyte meeting!
Before Getting Started
- Make sure you've read the
Getting Started with Dyte topic and
completed the steps in the
Integrate Dyte section.
You must complete the following steps:
- Create a Dyte Developer Account
- Create Presets
- Create a Dyte Meeting
- Add Participant to the meeting
- Install Xcode
- Ensure that Rosetta is installed with Xcode on Mac computers with Apple silicon.
- Make sure your Mac computers are running macOS version 12.0 Monterey or higher.
Step 1: Install the SDK
- Set your platform to iOS 12.0 or above in your Podfile.
platform :ios, '12.0'
- Add 'DyteiOSCore' to your Podfile.
pod 'DyteiOSCore'
- Install the client SDK from pod.
pod install
- Add the following entries to the info.plist file. This gives permission to your app to access the camera and microphone, access photos, install the required fonts and icons.
<key>NSBluetoothPeripheralUsageDescription</key>
<string>We will use your Bluetooth to access your Bluetooth headphones.</string>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>We will use your Bluetooth to access your Bluetooth headphones.</string>
<key>NSCameraUsageDescription</key>
<string>For people to see you during meetings, we need access to your camera.</string>
<key>NSMicrophoneUsageDescription</key>
<string>For people to hear you during meetings, we need access to your microphone.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>For people to share, we need access to your photos.</string>
If you intend to publish your app to the App Store, you'll need to perform a few additional steps. So if you’re working on release build and not debug builds, refer to the iOS release builds section.
Step 2: Initialize the SDK
- The
DyteMobileClient
is the main class of the SDK. It is the main entry point of the SDK. It is the only class that you need to instantiate in order to use the SDK. To instantiate DyteMobileClient, you should useDyteiOSClientBuilder().build()
.
let meeting = DyteiOSClientBuilder().build()
- Add listeners and implement callback stubs.
meeting.addMeetingRoomEventsListener(meetingRoomEventsListener: self)
meeting.addParticipantEventsListener(participantEventsListener: self)
meeting.addSelfEventsListener(selfEventsListener: self)
meeting.addParticipantEventsListener(participantEventsListener: self)
meeting.addChatEventsListener(chatEventsListener: self)
meeting.addPollEventsListener(pollEventsListener: self)
meeting.addRecordingEventsListener(recordingEventsListener: self)
meeting.addWaitlistEventListener(waitlistEventListener: self)
Step 3: Set the properties in the DyteMeetingInfo class
If you're using v1 APIs, then you need to pass the roonName and authToken. For v2, you just need to provide the participant's authToken.
You can get the roomName
and authToken
using our backend APIs. Please refer
this for room name &
this for auth token
Name | Description |
---|---|
roomName | Create a meeting API returns an unique identifier for your meeting roomName . |
authToken | After you've created the meeting, add each participant to the meeting using the Add Participant API (The presetName created earlier must be passed in the body of the Add Participant API request) The API response contains the authToken . |
For v1 APIs:
let meetingInfo = DyteMeetingInfo(authToken: authToken,
roomName: meetingText,
enableAudio: true,
enableVideo: true)
For v2 APIs:
let meetingInfo = DyteMeetingInfoV2(authToken: authToken,
enableAudio: true,
enableVideo: true,
baseUrl: Constants.BASE_URL)
Step 4: Initialize the connection request
To initialize the connection request, call the doInit()
method obtained on
meeting
with the meetingInfo
argument. This will establish the connection
with the Dyte meeting server.
For v1 APIs:
meeting.doInit(dyteMeetingInfo: meetingInfo)
For v2 APIs:
meeting.doInit(dyteMeetingInfo_: meetingInfo)
Step 5: Connect to the meeting
Now, you have established the connection with the Dyte meeting server
successfully. Once onMeetingInitCompleted()
is triggered, next step is to join
the room.
Join the room
To join the meeting room, do the following:
meeting.joinRoom()
Joina room event listeners: Once you call joinRoom()
, you can listen to
callbacks for this action on meeting object if you have done
meeting.addSelfEventsListener(selfEventsListener: self)
.
extension MeetingViewModel: DyteSelfEventsListener {
func onMeetingRoomJoinStarted() {
// meeting join started
}
func onMeetingRoomJoined() {
// meeting room joined succesfully
}
func onMeetingRoomJoinFailed(exception: KotlinException) {
// error in joining meeting room.
}
}
Leave the room
Once the meeting is over, you can leave the meeting room. To leave the meeting
call leaveRoom()
on meeting
object.
meeting.leaveRoom()
Leave room event listeners: You can listen to leaveRoom()
callbacks by
registering obsever on meeting object as follows:
extension MeetingViewModel: DyteSelfEventsListener {
func onMeetingRoomLeaveStarted() {
// meeting room leave started
}
func onMeetingRoomLeft() {
// meeting room leave completed
}
}
iOS release builds
Disable BITCODE
in your Podfile.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end