SwiftUI Video SDK ➡️ Stream Video 📹
This is the official iOS SDK for StreamVideo, a platform for building apps with video and audio calling support. The repository includes a low-level SDK and a set of reusable UI components, available in both UIKit and SwiftUI.
Stream allows developers to rapidly deploy scalable feeds, chat messaging and video with an industry leading 99.999% uptime SLA guarantee.
With Stream’s video components, you can use our SDK to build in-app video calling, audio rooms, audio calls, or live streaming. The best place to get started is with our tutorials:
Stream provides UI components and state handling that make it easy to build video calling for your app. All calls run on Stream’s network of edge servers around the world, ensuring optimal latency and reliability.
Stream is free for most side and hobby projects. To qualify, your project/company needs to have < 5 team members and < $10k in monthly revenue. Makers get $100 in monthly credit for video for free.
Here are some of the features we support:
Check our docs to get more details about the supported features and integration guides.
This repository contains the following parts:
tintColor
, padding, light/dark mode, dynamic font sizes, etc.The low-level client is used for establishing audio and video calls. It integrates with Stream’s backend infrastructure, and implements the WebRTC protocol.
Here are the most important components that the low-level client provides:
StreamVideo
- the main SDK object.Call
- an object that provides info about the call state, as well as methods for updating it.This is the main object for interfacing with the low-level client. It needs to be initialized with an API key and a user/token, before the SDK can be used.
let streamVideo = StreamVideo(
apiKey: "key1",
user: user.userInfo,
token: user.token,
videoConfig: VideoConfig(),
tokenProvider: { result in
yourNetworkService.loadToken(completion: result)
}
)
The Call
class provides all the information about the call, such as its participants, whether the call is being recorded, etc. It also provides methods to perform standard actions available during a call, such as muting/unmuting users, sending reactions, changing the camera input, granting permissions, recording, etc.
You can create a new Call
via the StreamVideo
’s method func call(callType: String, callId: String, members: [Member])
.
The SwiftUI SDK provides out of the box UI components, ready to be used in your app.
The simplest way to add calling support to your hosting view is to attach the CallModifier
:
struct CallView: View {
@StateObject var viewModel: CallViewModel
init() {
_viewModel = StateObject(wrappedValue: CallViewModel())
}
var body: some View {
HomeView(viewModel: viewModel)
.modifier(CallModifier(viewModel: viewModel))
}
}
You can customize the look and feel of the screens presented in the calling flow, by implementing the corresponding methods in our ViewFactory
.
Most of our components are public, so you can use them as building blocks if you want to build your custom UI.
All the texts, images, fonts and sounds used in the SDK are configurable via our Appearance
class, to help you brand the views to be inline with your hosting app.
The UIKit SDK provides UIKit wrappers around the SwiftUI views. Its main integration point is the CallViewController
which you can easily push in your navigation stack, or add as a modal screen.
private func didTapStartButton() {
let next = CallViewController.make(with: callViewModel)
next.modalPresentationStyle = .fullScreen
next.startCall(
callType: "default",
callId: callId,
members: members
)
self.navigationController?.present(next, animated: true)
}
The CallViewController
is created with a CallViewModel
- the same one used in our SwiftUI SDK.
At the moment, all the customizations in the UIKit SDK, need to be done in SwiftUI.
Video roadmap and changelog is available here.