At Video SDK, we’re building tools to help companies create world-class collaborative products with capabilities of live audio/videos, compose cloud recordings/rtmp/hls and interaction APIs
📲 Download the Sample iOS app here: https://testflight.apple.com/join/26EBZkcX
- Real-time video and audio conferencing
- Enable/disable camera
- Mute/unmute mic
- Chat
- Raise hand
- Recording
-
Sign up on VideoSDK and visit API Keys section to get your API key and Secret key.
-
Get familiarized with API key and Secret key
-
Get familiarized with Token
- iOS 12.0+
- Xcode 13.0+
- Swift 5.0+
- Valid Video SDK Account
git clone https://github.com/videosdk-live/videosdk-rtc-ios-sdk-example.git
Run pod install
in terminal from the Example project directory.
Generate temporary token from Video SDK Account.
public let AUTH_TOKEN = "#YOUR_GENERATED_TOKEN"
Run App from Xcode. Please run the app in real device for better experience because audio and video is not supported in simulator.
-
Meeting
- A Meeting represents Real time audio and video communication.Note : Don't confuse with Room and Meeting keyword, both are same thing 😃
-
Sessions
- A particular duration you spend in a given meeting is a referred as session, you can have multiple session of a particular meetingId. -
Participant
- Participant represents someone who is attending the meeting's session,local partcipant
represents self (You), for this self, other participants areremote participants
. -
Stream
- Stream means video or audio media content that is either published bylocal participant
orremote participants
.
- Your app needs to add permissions to use microphone and camera. Add below code your app's info.plist.
<key>NSCameraUsageDescription</key>
<string>Allow camera access to start video.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Allow microphone access to start audio.</string>
Token is used to create and validate a meeting using API and also initialise a meeting.
🛠️ Development Environment
:
- You may use a temporary token for development. To create a temporary token, go to VideoSDK dashboard .
🌐 Production Environment
:
- You must set up an authentication server to authorise users for production. To set up an authentication server, refer to our official example repositories. videosdk-rtc-api-server-examples
create meeting
- Please refer this documentation to create meeting.validate meeting
- Please refer this documentation to validate the meetingId.
- You can initialize the meeting using
VideoSDK.initMeeting
method. this method configures meeting with given meeting-id.
VideoSDK.config(token: "server-token")
meeting = VideoSDK.initMeeting(
meetingId: "meeting-id",
participantId: "participant-id"
participantName: "participant-name",
micEnabled: true,
webcamEnabled: true,
)
buttonControlsView.onVideoTapped = { on in
if !on {
self.meeting?.enableWebcam()
} else {
self.meeting?.disableWebcam()
}
}
buttonControlsView.onMicTapped = { on in
if !on {
self.meeting?.unmuteMic()
} else {
self.meeting?.muteMic()
}
}
AVAudioSession.sharedInstance().changeAudioOutput(presenterViewController: self)
- The chat feature allows participants to send and receive messages about specific topics to which they have subscribed.
// listen/subscribe for chat topic
meeting?.pubsub.subscribe(topic: CHAT_TOPIC, forListener: self)
//write this block on click event
meeting.pubSub.publish(topic: "CHAT", message: message, options: { persist: true })
//unsubscribing messages on topic CHAT
meeting.pubSub.unsubscribe("CHAT");
- This feature allows participants to raise hand during the meeting.
// listen/subscribe for raise-hand topic
meeting?.pubsub.subscribe(topic: RAISE_HAND_TOPIC, forListener: self);
// raise hand on click event
self.meeting?.pubsub.publish(topic: RAISE_HAND_TOPIC, message: "Raise Hand by Me", options: [:])
- Record meeting allows participants to record video & audio during the meeting. The recording files are available in developer dashboard. Any participant can start / stop recording any time during the meeting.
let webhookUrl = "https://webhook.your-api-server.com"
// start recording
meeting.startRecording(webhookUrl: webhookUrl)
// stop recording
stopRecording()
- Interactive Live Streaming allows participants to to broadcast live streaming to other participants. Host can start / stop HLS any time during the meeting.
// start live streaming
startLivestream(outputs: outputs)
// stop live streaming
stopLivestream()
// Only one participant will leave/exit the meeting; the rest of the participants will remain.
meeting?.leave();
// The meeting will come to an end for each and every participant. So, use this function in accordance with your requirements.
meeting?.end();
By registering callback handlers, VideoSDK sends callbacks to the client app whenever there is a change or update in the meeting after a user joins.
func onMeetingJoined() {
// This event will be emitted when a localParticipant(you) successfully joined the meeting.
print("onMeetingJoined");
}
func onMeetingLeft() {
// This event will be emitted when a localParticipant(you) left the meeting.
print("onMeetingLeft");
}
func onParticipantJoined(participant) {
// This event will be emitted when a new participant joined the meeting.
// [participant]: new participant who joined the meeting
print(" onParticipantJoined", participant);
}
func onParticipantLeft(participant) {
// This event will be emitted when a joined participant left the meeting.
// [participantId]: id of participant who left the meeting
print(" onParticipantLeft", participant);
}
func onSpeakerChanged = (activeSpeakerId) => {
// This event will be emitted when any participant starts or stops screen sharing.
// [activeSpeakerId]: Id of participant who shares the screen.
print(" onSpeakerChanged", activeSpeakerId);
};
func onRecordingStarted() {
// This event will be emitted when recording of the meeting is started.
print(" onRecordingStarted");
}
func onRecordingStopped() {
// This event will be emitted when recording of the meeting is stopped.
print(" onRecordingStopped");
}
By registering callback handlers, VideoSDK sends callbacks to the client app whenever a participant's video, audio, or screen share stream is enabled or disabled.
func onStreamEnabled(stream, participant) {
// This event will be triggered whenever a participant's video, audio or screen share stream is enabled.
print("onStreamEnabled");
}
func onStreamDisabled(stream, participant) {
// This event will be triggered whenever a participant's video, audio or screen share stream is disabled.
print(" onStreamDisabled");
}
If you want to learn more about the SDK, read the Complete Documentation of iOS VideoSDK
Note :
- main branch: Better UI with One-to-One and Conference call experience.
- v1-sample-code branch: Simple UI with Group call experience.
We have separated conrtroller and components in following folder structure:
VideoSDK
└── view
└── ButtonControlsView.swift
└── ParticipantCellView.swift
└── API
└── Constants.swift
└── APIService.swift
└── models
└── Message.swift
└── ChatUser.swift
└── MeetingData.swift
└── controllers
└── StartMeetingViewController.swift
└── MeetingViewController.swift
└── ChatViewController.swift
- videosdk-rtc-prebuilt-examples
- videosdk-rtc-javascript-sdk-example
- videosdk-rtc-react-sdk-examplee
- videosdk-rtc-react-native-sdk-example
- videosdk-rtc-flutter-sdk-example
- videosdk-rtc-android-java-sdk-example
- videosdk-rtc-android-kotlin-sdk-example
- videosdk-rtc-ios-sdk-example
- videosdk-hls-react-sdk-example
- videosdk-hls-react-native-sdk-example
- videosdk-hls-flutter-sdk-example
- videosdk-hls-android-java-example
- videosdk-hls-android-kotlin-example
Read the documentation to start using Video SDK.