测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可 | MIT |
发布最新发布 | 2018年3月 |
SPM支持 SPM | ✗ |
由 Ashari Juang、Ahmad Athaullah 维护。
依赖 | |
LFLiveKit | = 2.6 |
Alamofire | = 4.5.1 |
SwiftyJSON | = 3.1.4 |
Qiscus Streaming SDK 是一个让将语音通话和/或即时消息添加到移动应用变得容易的产品。它处理所有信令和音频管理的复杂性,同时为您创建出色的用户界面提供自由。
以下是一步一步的指南,介绍如何首次设置 Qiscus Streaming SDK
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
def import_pods
pod 'QiscusStreaming'
end
target 'Your Target' do
platform :ios, '8.0'
import_pods
end
添加到您的项目 Info.plist 中
<key>NSCameraUsageDescription</key>
<string>..</string>
<key>NSMicrophoneUsageDescription</key>
<string>..</string>
在您的应用程序类中使用您的 API 密钥初始化 Qiscus
QiscusStreaming(withConfig: config)
参数
import QiscusStreaming
let config = StreamConfig()
config.AppId = "Your_app_id"
client = QiscusStreaming(withConfig: config)
上面的示例 API 密钥具有有限的功能。要获取具有完整功能的 API 密钥,请联系我们。
在用户可以开始相互流式传输之前,他们必须创建流链接
QiscusStreaming.createStream(title: String, tags: [String], completion: @escaping (Stream?) -> Void)
参数
let config = StreamConfig()
config.AppId = "Your_app_id"
client = QiscusStreaming(withConfig: config)
client?.createStream(title: "streaming", tags: ["test"]) { (stream) in
print("stream url : \(stream?.streamUrl)")
}
Stream 对象
开始视频流
let config = StreamConfig()
config.AppId = "Your_app_id"
client = QiscusStreaming(withConfig: config)
client?.buildStream(streamUrl: url!, completionHandler: { (target, error) in
self.present(target, animated: true, completion: nil)
})
您可以从流对象中获取 stream_url。
import QiscusStreaming
var client : QiscusStreaming?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
buttonStream.addTarget(self, action: #selector(self.tapSample(_:)), for: UIControlEvents.touchUpInside)
buttonLive.addTarget(self, action: #selector(self.goStream(_:)), for: UIControlEvents.touchUpInside)
let config = StreamConfig()
config.AppId = "a3d2QkJXQ2M1YTdrTW1PYnVJSmJiUVczTkxmS3BRc05nYnRCOHRGUw=="
client = QiscusStreaming(withConfig: config)
}
func tapSample(_ sender: Any) {
client?.createStream(title: "streaming", tags: ["test"]) { (stream) in
print("stream url : \(stream?.streamUrl)")
self.urlTextField.text = stream?.streamUrl
}
}
func goStream(_ sender: Any) {
//
let url = self.urlTextField.text
client?.buildStream(streamUrl: url!, completionHandler: { (target, error) in
//
self.present(target, animated: true, completion: nil)
})
}
您可以使用 VLC(https://www.videolan.org/vlc/)测试实时流。
打开 Vlc,文件,打开网络,在调用 QiscusStream.createStream 方法后输入流 URL。