Giter VIP home page Giter VIP logo

pili-engineering / plmediastreamingkit Goto Github PK

View Code? Open in Web Editor NEW
540.0 30.0 243.0 526 MB

PLMediaStreamingKit 是七牛推出的一款适用于 iOS 平台的推流 SDK,支持 RTMP 推流,h.264 和 AAC 编码,硬编、软编支持。具有丰富的数据和状态回调,方便用户根据自己的业务定制化开发。具有直播场景下的重要功能,如:美颜、背景音乐、水印等功能。

Home Page: https://github.com/pili-engineering/PLMediaStreamingKit

License: Apache License 2.0

Objective-C 99.19% Ruby 0.50% C 0.31%

plmediastreamingkit's Introduction

PLMediaStreamingKit

PLMediaStreamingKit 是一个适用于 iOS 的 RTMP 直播推流 SDK,可高度定制化和二次开发。特色是支持 iOS Camera 画面捕获并进行 H.264 硬编码,以及支持 iOS 麦克风音频采样并进行 AAC 硬编码;同时,还根据移动网络环境的多变性,实现了一套可供开发者灵活选择的编码参数集合。借助 PLMediaStreamingKit,开发者可以快速构建一款类似 MeerkatPeriscope 的手机直播应用。PLMediaStreamingKit 支持两种不同层次的 API,分别为 PLMediaStreamingKit 和 PLStreamingKit, PLStreamingKit 提供包括音视频编码,封包以及网络发送功能,PLMediaStreamingKit 除了提供 PLStreamingKit 的功能以外还提供了内置的采集,音视频处理以及一些系统打断事件的处理等。我们强烈推荐对音视频没有太多了解的开发者使用 PLMediaStreamingKit 提供的 API 进行开发,如果您对音视频数据的采集和处理有更多的需求,那么需要使用 PLStreamingKit 提供的 API 进行开发,不过在进行开发之前请确保您已经掌握了包括音视频采集,编码以及处理等相关的基础支持。

功能特性

  • 支持硬件编码
  • 多码率可选
  • 支持 H.264 视频编码
  • 支持 HEVC 视频编码
  • 支持 AAC 音频编码
  • 支持前后摄像头
  • 支持自动对焦
  • 支持手动调整对焦点
  • 支持闪光灯操作
  • 支持多分辨率编码
  • 支持 HeaderDoc 文档
  • 支持构造带安全授权凭证的 RTMP 推流地址
  • 支持 ARMv7, ARM64, i386, x86_64 架构
  • 支持 RTMP 协议直播推流
  • 支持音视频配置分离
  • 支持推流时可变码率
  • 提供发送 buffer
  • 支持 Zoom 操作
  • 支持音频 Mute 操作
  • 支持视频 Orientation 操作
  • 支持自定义 DNS 解析
  • 支持弱网丢帧策略
  • 支持纯音频或纯视频推流
  • 支持后台音频推流
  • 支持自定义滤镜功能
  • 内置水印功能
  • 内置美颜功能
  • 支持返听功能
  • 支持内置音乐播放器混音功能
  • 支持内置音效功能
  • 内置动态帧率功能
  • 内置自适应码率功能
  • 内置断线及网络切换自动重连功能
  • 支持预览与直播流分别镜像
  • 支持自定义音视频处理
  • 支持苹果 ATS 安全标准
  • 提供两种层次的 API,灵活选择,高可定制性与简单两不误
  • 支持后台推图片功能
  • 支持 QUIC 推流功能
  • 支持推流 SEI 功能
  • 支持动态设置 userUID 功能
  • 支持编码时设置图像填充方式
  • 支持推流过程中设置 fps

系统要求

  • iOS Target : >= iOS 8
  • iOS Device : >= iPhone 5

版本升级

  • 从 v3.0.7 开始,HappyDNS 版本更新至 v1.0.0
  • 从 v3.0.0 版本开始,七牛直播推流 SDK 需要先获取授权才能使用。授权分为试用版和正式版,可通过 400-808-9176 转 1 号线联系七牛商务咨询,或者 通过工单 联系七牛的技术支持。
  • v3.0.0 之前的版本不受影响,请继续放心使用。
  • 老客户升级 v3.0.0 版本之前,请先联系七牛获取相应授权,以免发生鉴权不通过的现象。
  • 基于 114 dns 解析的不确定性,使用该解析可能会导致解析的网络 ip 无法做到最大的优化策略,进而出现推流质量不佳的现象。因此建议使用非 114 dns 解析
  • 目前 srt 协议不支持 hevc 推流

安装方法

CocoaPods 是针对 Objective-C 的依赖管理工具,它能够将使用类似 PLMediaStreamingKit 的第三方库的安装过程变得非常简单和自动化,你能够用下面的命令来安装它:

$ sudo gem install cocoapods

构建 PLMediaStreamingKit 2.0.0+ 需要使用 CocoaPods 0.39.0+

Podfile

为了使用 CoacoaPods 集成 PLMediaStreamingKit 到你的 Xcode 工程当中,你需要编写你的 Podfile

source 'https://github.com/CocoaPods/Specs.git'
target 'TargetName' do
pod 'PLMediaStreamingKit'
end
  • 默认为真机版
  • 若需要使用模拟器 + 真机版,则改用如下配置
pod "PLMediaStreamingKit", :podspec => 'https://raw.githubusercontent.com/pili-engineering/PLMediaStreamingKit/master/PLMediaStreamingKit-Universal.podspec'	

注意:鉴于目前 iOS 上架,只支持动态库真机,请在 App 上架前,更换至真机版本

然后,运行如下的命令:

$ pod install

PLMediaStreamingKit 文档

请参考开发者中心文档:PLMediaStreamingKit 文档

反馈及意见

当你遇到任何问题时,可以通过在 GitHub 的 repo 提交 issues 来反馈问题,请尽可能的描述清楚遇到的问题,如果有错误信息也一同附带,并且在 Labels 中指明类型为 bug 或者其他。

通过这里查看已有的 issues 和提交 Bug。

plmediastreamingkit's People

Contributors

anhaoxiong avatar depthlove avatar herashowfeng avatar huangdeheng avatar jpxiong avatar kivenhaoyu avatar lawder avatar moskize avatar shengqiangliu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plmediastreamingkit's Issues

推流过程中,调用系统相机,画面卡住

在推流过程中,调用系统的拍照功能,然后回到直播画面,画面就卡住不动了,有什么解决办法吗?
尝试过调用一次toggleCamera,画面就正常了,有别的正常解决方案吗?

如何判定主播离开

现在想做一个类似映客花椒主播离开时的功能,就是主播进入后台时,会给在房间里的人发一条“主播暂时离开中...”这样类似的信息。
但我发现咱们这个当推流端每次切换应用进入后台时,state 会从 “ Disconnecting -> Disconnected -> Connecting -> Connecting ”走两遍,然后开始推
"Stream Status:
Video FPS: 0.0
Audio FPS: 0.0
TotalBitrate: 0.0 bps(0.0 KB/s)"
疑问就来了,为什么会走两遍呢?
还有你们觉得应该是屏蔽其中一遍,在主播状态进入“Disconnecting”时给观众发送,还是应该程序走“applicationDidEnterBackground”时给观众发送。来点建议吧~ 七牛云开发帅哥们

在模拟器报错 - PLMediaStreamingKit, 2.1.6

Undefined symbols for architecture x86_64:
"OBJC_CLASS$_PLVideoStreamingConfiguration", referenced from:
objc-class-ref in AnchorLiveSession.o
"OBJC_CLASS$_PLCameraStreamingSession", referenced from:
objc-class-ref in AnchorLiveSession.o
"OBJC_CLASS$_PLAudioStreamingConfiguration", referenced from:
objc-class-ref in AnchorLiveSession.o
"OBJC_CLASS$_PLAudioCaptureConfiguration", referenced from:
objc-class-ref in AnchorLiveSession.o
"OBJC_CLASS$_PLVideoCaptureConfiguration", referenced from:
objc-class-ref in AnchorLiveSession.o
"OBJC_CLASS$_PLStreamingEnv", referenced from:
objc-class-ref in AnchorLiveSession.o
"OBJC_CLASS$_PLStream", referenced from:
objc-class-ref in AnchorLiveSession.o
"_kPLVideoStreamingQualityMedium1", referenced from:
-[AnchorLiveSession VideoStreamConfFromLiveQuality:] in AnchorLiveSession.o
"_kPLVideoStreamingQualityMedium2", referenced from:
-[AnchorLiveSession VideoStreamConfFromLiveQuality:] in AnchorLiveSession.o
"_kPLVideoStreamingQualityMedium3", referenced from:
-[AnchorLiveSession VideoStreamConfFromLiveQuality:] in AnchorLiveSession.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Pod linking error.

用pod集成有链接错误

Undefined symbols for architecture arm64:
  "_hmac_sha1", referenced from:
      _generate_push_url in libPLMediaStreamingKit.a(pili_auth.o)
     (maybe you meant: _crypto_policy_set_null_cipher_hmac_sha1_80, _crypto_policy_set_aes_cm_128_hmac_sha1_32 , _crypto_policy_set_aes_cm_256_hmac_sha1_32 , _crypto_policy_set_aes_cm_256_hmac_sha1_80 )
  "_urlsafe_b64_encode", referenced from:
      _generate_push_url in libPLMediaStreamingKit.a(pili_auth.o)
ld: symbol(s) not found for architecture arm64

谁有解决方案啊

希望能最低支持iOS7.0

ld: warning: object file (/Users/cc/Desktop/MKsvn/HuaSeHui/SourceCode/iOS/JiaJuYuan/Pods/PLMediaStreamingKit/Pod/Library/libPLMediaStreamingKit.a(MuseRealTimeProcessor.o)) was built for newer iOS version (8.0) than being linked (7.0)
编译后有一堆这样的警告,希望下个版本能解决。

PLPlayerKit (2.2.4)

我正在基于PLPlayer 定制一个播放器,请问一下 有没有类似 缓冲进度的API? 类似 AVPlayer 的 playableDuration

bug

偶尔出现关闭播放器 pop到上一个控制器, 仍然能听到直播声音

推流错误

PILI_RTMP send error. scoket error: Resource temporarily unavailable,这是什么错误啊,经常推着推着出现这个错误

使用pod无法加载

[!] Unable to find a specification for PLMediaStreamingKit

这是pod install 之后发生的结果, 是没有更新吗, 还是怎样, 无法通过pod加载吗

the url is not authorized

I have downloaded the project and set the streamURL, after building it I am getting the error
"the url is not authorized". Is there any standard format for URL ?

连麦

请问下七牛云直播的连麦功能是如何实现的,我们产品最近要加“连麦”功能,我在开发者中心没看见这块内容,是需要我们自己来写这一块吗?

@protocol PLMediaStreamingSessionDelegate <NSObject> 有的代理不调用

我实现了一下几个
1.- (void)mediaStreamingSession:(PLMediaStreamingSession *)session streamStateDidChange:(PLStreamState)state {
}
2。/// @abstract 当开始推流时,会每间隔 3s 调用该回调方法来反馈该 3s 内的流状态,包括视频帧率、音频帧率、音视频总码率

(void)mediaStreamingSession:(PLMediaStreamingSession *)session streamStatusDidUpdate:(PLStreamStatus *)status {}
/// @abstract 获取到摄像头原数据时的回调, 便于开发者做滤镜等处理,需要注意的是这个回调在 camera 数据的输出线程,请不要做过于耗时的操作,否则可能会导致推流帧率下降
(CVPixelBufferRef)mediaStreamingSession:(PLMediaStreamingSession *)session cameraSourceDidGetPixelBuffer:(CVPixelBufferRef)pixelBuffer {
RCTrace(@"cameraSourceDidGetPixelBuffer");
return pixelBuffer;
}
1和2 都会调用,但是3 没有调用。Tag :2.1.6

在摄像头原数据的回调中返回一个新创建的CVPixelBufferRef,出现crash

回调方法:- (CVPixelBufferRef)cameraStreamingSession:(PLCameraStreamingSession *)session cameraSourceDidGetPixelBuffer:(CVPixelBufferRef)pixelBuffer
在这个方法中做了滤镜操作,根据pixelBuffer创建了新的CVPixelBufferRef,并将其返回。然后出现crash,信息如下:

CoreFoundation`CFRelease:
0x1904b63e8 <+0>: cbz x0, 0x1904b644c ; <+100>
0x1904b63ec <+4>: tbz x0, #63, 0x1904b63f4 ; <+12>
0x1904b63f0 <+8>: ret
0x1904b63f4 <+12>: ldr x8, [x0]
0x1904b63f8 <+16>: adrp x9, 151358
0x1904b63fc <+20>: ldr x9, [x9, #3688]
0x1904b6400 <+24>: cmp x8, #0 ; =0
0x1904b6404 <+28>: ccmp x8, x9, #4, ne
0x1904b6408 <+32>: b.eq 0x1904b6444 ; <+92>
0x1904b640c <+36>: ldr w9, [x0, #8]
0x1904b6410 <+40>: ubfx w9, w9, #8, #10
0x1904b6414 <+44>: adrp x10, 151356
0x1904b6418 <+48>: add x10, x10, #3680 ; =3680
0x1904b641c <+52>: ldr x9, [x10, w9, uxtw #3]
0x1904b6420 <+56>: cmp x8, x9
0x1904b6424 <+60>: b.eq 0x1904b6444 ; <+92>
0x1904b6428 <+64>: tbz w8, #0, 0x1904b6448 ; <+96>
0x1904b642c <+68>: adrp x10, 126695
0x1904b6430 <+72>: ldr x10, [x10, #408]
0x1904b6434 <+76>: ldr x10, [x10]
0x1904b6438 <+80>: and x8, x10, x8
0x1904b643c <+84>: cmp x8, x9
0x1904b6440 <+88>: b.ne 0x1904b6448 ; <+96>
0x1904b6444 <+92>: b 0x19058f99c ; _CFRelease
0x1904b6448 <+96>: b 0x18f030150 ; objc_release
0x1904b644c <+100>: adrp x8, 145472
0x1904b6450 <+104>: add x8, x8, #2296 ; =2296
0x1904b6454 <+108>: adrp x9, 853
0x1904b6458 <+112>: add x9, x9, #2237 ; =2237
0x1904b645c <+116>: str x9, [x8, #8]
-> 0x1904b6460 <+120>: brk #0x1

另外,我在只对原pixelBuffer进行某些修改的时候是OK的。创建的新CVPixelBufferRef,可以看到结果是正确的。所以想请问一下,是否有什么需要特别注意的地方?

修改sessionPreset没起作用

修改sessionPreset没起作用

dispatch_async(self.sessionQueue, ^{
    self.session.videoCaptureConfiguration.sessionPreset = AVCaptureSessionPreset1280x720;
});

画质没有任何变化,求解正确方式

CocoaPods download repo仓库失败

git clone CocoaPods Specs 文件失败 过了15分钟左右后报错SSL read()错误。

git clone PLMediaStreamingKit 也是失败,报错类型和 clone CocoaPods Specs 类似 。

都是因为下载的 文件较大,100MB+。

CocoaPods Specs 下载失败,通过手动下载Specs文件,替换解决了。

clone PLMediaStreamingKit 挂VPN 也没有得到有效的解决。

有没有什么解决办法

推流失败

feedback一直等于3,说是推流地址未授权,这是什么意思

更新 PLMediaStreamingKit(2.1.4) 和 PLPlayerKit(2.3.0) 失败

pod 错误信息如下:

[!] The 'Pods-MU' target has transitive dependencies that include static binaries: (/Users/Hyz/Desktop/Project_MU/MU/Pods/pili-ffmpeg/pili-ffmpeg/lib/libavcodec.a, /Users/Hyz/Desktop/Project_MU/MU/Pods/pili-ffmpeg/pili-ffmpeg/lib/libavformat.a, /Users/Hyz/Desktop/Project_MU/MU/Pods/pili-ffmpeg/pili-ffmpeg/lib/libavutil.a, and /Users/Hyz/Desktop/Project_MU/MU/Pods/pili-ffmpeg/pili-ffmpeg/lib/libswresample.a)

库的版本冲突

pod的时候指定2.1.1出现版本冲突。
[!] Unable to satisfy the following requirements:

  • pili-librtmp (= 1.0.4) required by PLMediaStreamingKit (2.1.0)
  • pili-librtmp (= 1.0.3.1) required by PLStreamingKit (1.2.5)
  • pili-librtmp (= 1.0.3.1) required by PLStreamingKit/precompiled (1.2.5)

后台推流

请问下后台推流是怎么开启,我看了 CameraStreamingKit 和 StreamingKit 里的头文件,没有找到关于后台推流。

如何直播的时候,添加一个震动

如题,
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
直播开始的时候,调取系统的震动方法,手机不会有反应,请问可以有办法可以处理这种情况么?

videoCaptureConfiguration切换

1.8+版本
- (void)reloadVideoStreamingConfiguration:(PLVideoStreamingConfiguration *)videoStreamingConfiguration videoCaptureConfiguration:(PLVideoCaptureConfiguration *)videoCaptureConfiguration DEPRECATED_ATTRIBUTE;

2.0+版本
- (void)reloadVideoStreamingConfiguration:(PLVideoStreamingConfiguration *)videoStreamingConfiguration;

1.8的版本提供了第一个方法,2.0版本这个方法过期了,没有了videoCaptureConfiguration参数,请问现在怎么切换videoCaptureConfiguration

主播直播时卡顿的问题

请问关于弱网络优化这块,我们的app没有任何处理,只是开启了sdk中的这两个设置,但是有反馈直播卡顿的问题,请问我还需要设置哪里么?

[self.session enableAdaptiveBitrateControlWithMinVideoBitRate:128*1024];
 self.session.dynamicFrameEnable = YES;

其中 PLVideoStreamingConfiguration 设置为kPLVideoStreamingQualityMedium2
PLAudioStreamingConfiguration 设置为kPLAudioStreamingQualityHigh1

还要对videoStreamingConfiguration的expectedSourceVideoFrameRate 进行设置么?

推流地址设置

服务端新的 SDK 获取的推流地址是一个 URL 字符串,而不是 JSON 字符串,请问客户端怎么初始化 PLStream?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.