More and more companies have launched their own iOS live stream SDK, which shows the rapid development trend of the live streaming market.
According to eMarketer forecasts, 2.72 billion people will watch videos on their mobile phones in 2023. That's up from 2.16 billion in 2019. This represents a compound annual growth rate (CAGR) of 6%βhigher than the 4.5% CAGR for worldwide digital video viewers.
What features do you need for live streaming
With the continuous development of the live streaming industry, live streaming has been divided into several sub-industries.
such as game live streaming, education live streaming, live streaming with goods, and live streaming of entertainment.
Different live streaming industries require different functions.
Basic function:
- Room management
- Audio and video push-pull stream management
- Device management
- Member management
- Barrage
Special function:
- Screen sharing
- shopping cart
- Gift effects
- Host PK
- Make co-hosts
A complete live streaming application is a complex system. Most enterprises will use the live stream SDK for iOS to quickly build a live broadcast platform and occupy the live streaming market.
What support is provided by the live streaming SDK
The development of live streaming SDK is also developing in a simple and convenient direction, from providing the underlying audio and video transmission capability to a complete live streaming solution, to the current componentized solution.
It can not only meet the requirements of customers for rapid construction but also meet the various personalized needs of customers.
ZEGOCLOUD's latest ios live stream SDK - Live Streaming Kit. It is a componentized solution. The SDK encapsulates the live streaming function into an independent component and provides rich UI custom interfaces. Users select components according to their own needs and customize the UI.
How to build an app with live streaming SDK
Next, I will use the live video streaming iOS SDK to demonstrate how to quickly build a live video streaming app.
Add ZegoUIKitPrebuiltLiveStreaming as dependencies
Integrate ZegoUIKitPrebuiltLiveStreaming SDK through the pod as follows, add pod 'ZegoUIKitPrebuiltLiveStreaming' in Podfile file. Then execute the command pod install
in Terminal. For detailed operation, please refer to Quick Access Documentation.
target 'ZegoCallDemo' do
use_frameworks!
# Pods for ZegoCallDemo
pod 'ZegoUIKitPrebuiltLiveStreaming'
end
Import ZegoUIKitSDK & ZegoUIKitPrebuiltCall to your project
In the file that needs to be called the SDK interface, import the SDK through import.
import ZegoUIKitSDK
import ZegoUIKitPrebuiltLiveStreaming
// YourViewController.swift
class MainViewController: UIViewController {
//Other code...
}
Using the ZegoUIKitPrebuiltLiveStreamingVC in your project
- Go to ZEGOCLOUD Admin Console, get the
appID
andappSign
of your project. - Specify the
userID
anduserName
for connecting the Live Streaming Kit service. -
liveID
represents the live streaming you want to start or watch (only supports single-host live streaming for now).
// YourViewController.swift
class MainViewController: UIViewController {
// Other code...
var userID: String = <#UserID#>
var userName: String = <#UserName#>
var liveID: String = <#liveID#>
func startLive() {
let config: ZegoUIKitPrebuiltLiveStreamingConfig = ZegoUIKitPrebuiltLiveStreamingConfig(kPresetRoleHost)
let liveVC: ZegoUIKitPrebuiltLiveStreamingVC = ZegoUIKitPrebuiltLiveStreamingVC(yourAppID, appSign: yourAppSign, userID: self.userID, userName: self.userName, liveID: self.liveID, config: config)
liveVC.modalPresentationStyle = .fullScreen
self.present(liveVC, animated: true, completion: nil)
}
func watchLive() {
let config: ZegoUIKitPrebuiltLiveStreamingConfig = ZegoUIKitPrebuiltLiveStreamingConfig(kPresetRoleAudience)
let liveVC: ZegoUIKitPrebuiltLiveStreamingVC = ZegoUIKitPrebuiltLiveStreamingVC(yourAppID, appSign: yourAppSign, userID: self.userID, userName: self.userName, liveID: self.liveID, config: config)
liveVC.modalPresentationStyle = .fullScreen
self.present(liveVC, animated: true, completion: nil)
}
}
Then, you can start live streaming by presenting the liveVC
.
Configure your project
Open the Info.plist
, add the following code inside the dict
part:
<key>NSCameraUsageDescription</key>
<string>We require camera access to connect to a call</string>
<key>NSMicrophoneUsageDescription</key>
<string>We require microphone access to connect to a call</string>
Run the demo
Sign up with ZEGOCLOUD, and get 10,000 minutes free every month.
Did you know? π
Like and Follow is the biggest encouragement to me
Follow me to learn more technical knowledge
Thank you for reading :)
Learn more
This is one of the live technical articles. Welcome to other articles:
Top comments (0)