iOS swift5 AWS直播 WebRTC SDK for iOS Kinesis Video Streams

2024-05-28 09:52

本文主要是介绍iOS swift5 AWS直播 WebRTC SDK for iOS Kinesis Video Streams,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

  • 1.官方文档
  • 2.github地址
  • 3.具体操作(本人已调试成功,并成功集成到项目里)
    • 3.1 下载官方demo,并且按官方文档的步骤来,跑通demo,在demo中可以正常直播
    • 3.2 看懂demo里的代码后,将demo里的代码移植到自己的项目里

1.官方文档

WebRTC SDK for iOS - AWS

2.github地址

Amazon Kinesis Video iOS WebRTC Sample - github

3.具体操作(本人已调试成功,并成功集成到项目里)

3.1 下载官方demo,并且按官方文档的步骤来,跑通demo,在demo中可以正常直播

请添加图片描述

  • 注意
  • demo需要注册,登录,登录成功后再点击直播

3.2 看懂demo里的代码后,将demo里的代码移植到自己的项目里

  • 如下,可以将demo里的Podfile文件直接拷贝到自己项目的Podfile文件里
# Uncomment the next line to define a global platform for your projectplatform :ios, '13.0'target 'XXX' do# Comment the next line if you don't want to use dynamic frameworksuse_frameworks!# Pods for XXXpod 'SnapKit'pod 'Moya'pod 'IQKeyboardManagerSwift'pod 'SmartCodable'# pod 'XHToastSwift'# AWSpod 'AWSCognitoIdentityProvider'pod 'AWSMobileClient'pod 'CommonCryptoModule'pod 'AWSKinesisVideo'pod 'AWSKinesisVideoSignaling'pod 'GoogleWebRTC', '~> 1.1'pod 'Starscream', '~> 3.0'end# AWS
post_install do |installer|installer.generated_projects.each do |project|project.targets.each do |target|target.build_configurations.each do |config|config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'endendendinstaller.pods_project.targets.each do |target|target.build_configurations.each do |config|config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"endendinstaller.pods_project.build_configurations.each do |config|config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = $iOSVersionend
end
  • 如下,是demo能正常直播时的打印log,我选的是Connect as Viewer
经过:signalClientDidConnect(_:)
经过:present(self.vc
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:Received remote candidate from []
经过:Received remote sdp from []
经过:WebRTC checking state
经过:Generated local candidate
经过:Generated local candidate
经过:Setting remote sdp and sending answer.
经过:Received remote candidate from []
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:Generated local candidate
经过:WebRTC connected/completed state
  • 需要signalClientDidConnect后再加载直播界面,所以下面的代码中要等2秒
        // Create the video viewlet seconds = 2.0DispatchQueue.main.asyncAfter(deadline: .now() + seconds) {self.updateConnectionLabel()self.vc = VideoViewController(webRTCClient: self.webRTCClient!, signalingClient: self.signalingClient!, localSenderClientID: self.localSenderId, isMaster: self.isMaster, mediaServerEndPoint: endpoints["WEBRTC"] ?? nil)print("经过:present(self.vc")self.present(self.vc!, animated: true, completion: nil)}
extension ChannelConfigurationViewController: SignalClientDelegate {func signalClientDidConnect(_: SignalingClient) {signalingConnected = trueprint("经过:\(#function)")}
  • 在我自己的项目里我没有等2秒,直接连上后再加载直播界面
extension VideoVC: SignalClientDelegate {func signalClientDidConnect(_: SignalingClient) {MyPrint("经过:\(#function)")signalingConnected = true//必须要连接上后再加载视频loadVideoView()}

这篇关于iOS swift5 AWS直播 WebRTC SDK for iOS Kinesis Video Streams的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1010232

相关文章

iOS HTTPS证书不受信任解决办法

之前开发App的时候服务端使用的是自签名的证书,导致iOS开发过程中调用HTTPS接口时,证书不被信任 - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAu

IOS 数组去重的几种方式

本来只知道NSSet和KeyValues的。今天又新学了几种方式 还有就是和同事学的一种方式 外层循环从0开始遍历,内层从最后一个元素开始遍历 for(int i=0;i<index;i++){  for(int j=index-1;j>i;j-- ){ } }

iOS Assertion failure in -[UITableView _classicHeightForRowAtIndexPath:]

iOS Assertion failure in -[UITableView _classicHeightForRowAtIndexPath:]  2015-04-24 11:40  956人阅读  评论(0)  收藏  举报   分类:   iOS 基础篇(208)  版权声明:本文为博主原创文章,未经博主允许不得转载。 Assertion

iOS:编译时出现no such file or directory:xxx以及use twice...filenames are used to distinguish private dec

简    注册  登录   添加关注 作者  婉卿容若 2016.04.29 11:22 写了21870字,被16人关注,获得了14个喜欢 iOS:编译时出现"no such file or directory:xxx"以及"use twice...filenames are used to distinguish private

iOS 到处 ipa包的时候 会有四个选项分别代表什么

如图 在 iOS 到处 ipa包的时候 会有四个选项  1.Save for iOS App Store Deployment 保存到本地 准备上传App Store 或者在越狱的iOS设备上使用 2.Save for Ad Hoc Deployment 保存到本地 准备在账号添加的可使用设备上使用(具体为在开发者账户下添加可用设备的udid),该app包是发布证书编

iOS 7适配上存在的各种问题

谈谈项目中遇到的各种iOS7适配问题 由于我的项目要适配到iOS7.1, 而现在已经是9时代了,在实际工作中我也是遇到了各种奇葩的坑,所以我想尽快把遇到的iOS7适配问题和解决方案分享出来,以后这些东西可能就用处不大了。   1.字体问题 iOS7中的字体适配恐怕是最麻烦的坑了,原因是iOS7以上的许多字体在7都是不存在的,甚至包括一些system-字体。比如system-

潜艇伟伟迷杂交版植物大战僵尸2024最新免费安卓+ios苹果+iPad分享

嗨,亲爱的游戏迷们!今天我要给你们种草一个超有趣的游戏——植物大战僵尸杂交版。这款游戏不仅继承了原有经典游戏的核心玩法,还加入了许多创新元素,让玩家能够体验到前所未有的乐趣。快来跟随我一起探索这个神奇的世界吧! 植物大战僵尸杂交版最新绿色版下载链接: https://pan.quark.cn/s/d60ed6e4791c 🔥 创新与经典的完美结合 植物大战僵尸杂交版在保持了原游戏经典玩

浏览器在iOS或Android中的一些方法

判断当前应用 var deviceType="H5"if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {deviceType='ios'} else if (/(Android)/i.test(navigator.userAgent)) {// alert("Android");deviceType='android'} else

导入别人的net文件报红问题sdk

1. 使用cmd命令 dotnet --info 查看自己使用的SDK版本 2.直接找到项目中的 global.json 文件,右键打开,直接修改版本为本机的SDK版本,就可以用了

FFplay源码分析-video_thread

《FFmpeg原理》的社群来了,想加入社群的朋友请购买 VIP 版,VIP 版有更高级的内容与答疑服务。 本系列 以 ffmpeg4.2 源码为准,下载地址:链接:百度网盘 提取码:g3k8 FFplay 源码分析系列以一条简单的命令开始,ffplay -i a.mp4。a.mp4下载链接:百度网盘,提取码:nl0s 。 上一篇文章已经讲解完了 audio_thread() 音频解码