LSMediaCapture Class Reference
Inherits from | NSObject |
---|---|
Declared in | LSMediaCapture.h |
audioCaptureDelegate
音频采集delegate
@property (nonatomic, weak) id<LSAudioCaptureDelegate> audioCaptureDelegate
Discussion
音频采集delegate
Declared In
LSMediaCapture.h
pushUrl
推流地址
@property (nonatomic, copy) NSString *pushUrl
Discussion
推流地址
Declared In
LSMediaCapture.h
onLiveStreamError
直播过程中发生错误的回调函数
@property (nonatomic, copy) void ( ^ ) ( NSError *error ) onLiveStreamError
Parameters
error |
具体错误信息 |
---|
Discussion
直播过程中发生错误的回调函数
Declared In
LSMediaCapture.h
onStatisticInfoGot
得到直播过程中的统计信息
@property (nonatomic, copy) void ( ^ ) ( LSStatisticsObject *statistics ) onStatisticInfoGot
Parameters
statistics |
统计信息结构体 |
---|
Discussion
得到直播过程中的统计信息
Declared In
LSMediaCapture.h
– initLiveStream:
初始化mediacapture
- (instancetype)initLiveStream:(NSString *)liveStreamingURL
Parameters
liveStreamingURL |
推流的url地址 |
---|
Return Value
LSMediaCapture
Discussion
初始化mediacapture
Declared In
LSMediaCapture.h
– initLiveStream:withVideoParaCtxConfiguration:
初始化mediacapture
- (instancetype)initLiveStream:(NSString *)liveStreamingURL withVideoParaCtxConfiguration:(LSVideoParaCtxConfiguration *)videoParaCtx
Parameters
liveStreamingURL |
推流的url |
---|---|
videoParaCtx |
推流视频参数 |
Return Value
LSMediaCapture
Discussion
初始化mediacapture
Declared In
LSMediaCapture.h
– initLiveStream:withLivestreamParaCtxConfiguration:
初始化mediacapture
- (instancetype)initLiveStream:(NSString *)liveStreamingURL withLivestreamParaCtxConfiguration:(LSLiveStreamingParaCtxConfiguration *)configuration
Parameters
liveStreamingURL |
推流的url |
---|---|
configuration |
推流参数 |
Return Value
LSMediaCapture
Discussion
初始化mediacapture
Declared In
LSMediaCapture.h
– unInitLiveStream
反初始化:释放资源
- (void)unInitLiveStream
Discussion
反初始化:释放资源
Declared In
LSMediaCapture.h
– startVideoPreview:
打开视频预览
- (void)startVideoPreview:(UIView *)preview
Parameters
preview |
预览窗口 |
---|
Discussion
打开视频预览
Declared In
LSMediaCapture.h
– pauseVideoPreview
暂停视频预览,如果正在直播,则同时关闭视频预览以及视频推流
- (void)pauseVideoPreview
Discussion
Warning: 暂停视频预览,如果正在直播,则同时关闭视频预览以及视频推流
Declared In
LSMediaCapture.h
– resumeVideoPreview
继续视频预览,如果正在直播,则开始视频推流
- (void)resumeVideoPreview
Discussion
Warning: 继续视频预览,如果正在直播,则开始视频推流
Declared In
LSMediaCapture.h
– startLiveStream:
开始直播
- (void)startLiveStream:(void ( ^ ) ( NSError *error ))completionBlock
Parameters
completionBlock |
具体错误信息 |
---|
Discussion
开始直播
Declared In
LSMediaCapture.h
– stopLiveStream:
结束推流
- (void)stopLiveStream:(void ( ^ ) ( NSError *error ))completionBlock
Discussion
结束推流
Warning: 只有直播真正开始后,也就是收到LSLiveStreamingStarted消息后,才可以关闭直播,error为nil的时候,说明直播结束,否则直播过程中发生错误
Declared In
LSMediaCapture.h
– resumeVideoLiveStream
重启开始视频推流
- (void)resumeVideoLiveStream
Discussion
重启开始视频推流
Warning: 需要先启动推流startLiveStreamWithError,开启音视频推流,才可以中断视频推流,重启视频推流,
Declared In
LSMediaCapture.h
– pauseVideoLiveStream
中断视频推流
- (void)pauseVideoLiveStream
Discussion
中断视频推流
Warning: 需要先启动推流startLiveStreamWithError,开启音视频推流,才可以中断视频推流,重启视频推流,
Declared In
LSMediaCapture.h
– resumeAudioLiveStream
重启音频推流, @warning:需要先启动推流startLiveStreamWithError,开启音视频推流,才可以中断音频推流,重启音频推流,
- (BOOL)resumeAudioLiveStream
Discussion
重启音频推流, @warning:需要先启动推流startLiveStreamWithError,开启音视频推流,才可以中断音频推流,重启音频推流,
Declared In
LSMediaCapture.h
– pauseAudioLiveStream
中断音频推流, @warning:需要先启动推流startLiveStreamWithError,开启音视频推流,才可以中断音频推流,重启音频推流,
- (BOOL)pauseAudioLiveStream
Discussion
中断音频推流, @warning:需要先启动推流startLiveStreamWithError,开启音视频推流,才可以中断音频推流,重启音频推流,
Declared In
LSMediaCapture.h
– updateCutomStatistics:
更新自定义统计数据
- (void)updateCutomStatistics:(NSDictionary *)customDict
Parameters
customDict |
自定义统计数据(key,value) |
---|
Discussion
更新自定义统计数据
Declared In
LSMediaCapture.h
– checkIsLiving
检查是否正在直播
- (BOOL)checkIsLiving
Return Value
bool值
Discussion
检查是否正在直播
Declared In
LSMediaCapture.h
– setTraceLevel:
设置trace 的level
- (void)setTraceLevel:(LSMediaLog)logLevel
Parameters
logLevel |
trace 信息的级别 |
---|
Discussion
设置trace 的level
Declared In
LSMediaCapture.h
+ getSDKVersionID
获取当前sdk的版本号
+ (NSString *)getSDKVersionID
Discussion
获取当前sdk的版本号
Declared In
LSMediaCapture.h
– currentSyncTimestamp
获取当前视频帧时间戳,对应syncTimestamp一起使用
- (uint64_t)currentSyncTimestamp
Return Value
时间戳
Discussion
获取当前视频帧时间戳,对应syncTimestamp一起使用
Declared In
LSMediaCapture.h
– currentStreamTimestamp
获取当前时间戳,对应streamTimestampPassthrough一起使用
- (uint64_t)currentStreamTimestamp
Return Value
时间戳
Discussion
获取当前时间戳,对应streamTimestampPassthrough一起使用
Declared In
LSMediaCapture.h
– sendCustomData:
发送自定义数据
- (NSError *)sendCustomData:(LSCustomDataObject *)sendObject
Parameters
sendObject |
自定义对象 |
---|
Discussion
发送自定义数据
Declared In
LSMediaCapture.h
– startRecord:videoStreamingQuality:
开始录制并保存本地文件(mp4录制)
- (BOOL)startRecord:(NSString *)recordFileName videoStreamingQuality:(LSVideoStreamingQuality)videoStreamingQuality
Parameters
recordFileName |
本地录制的文件全路径 |
---|---|
videoStreamingQuality |
需要录制的mp4文件的分辨率,不能大于采集的分辨率 |
Return Value
是否成功
Discussion
开始录制并保存本地文件(mp4录制)
Declared In
LSMediaCapture.h
– startPlayMusic:withEnableSignleFileLooped:
开始播放混音文件
- (BOOL)startPlayMusic:(NSString *)musicURL withEnableSignleFileLooped:(BOOL)enableLoop
Parameters
musicURL |
音频文件地址/文件名 |
---|---|
enableLoop |
当前音频文件是否单曲循环 |
Discussion
开始播放混音文件
Declared In
LSMediaCapture.h
– stopPlayMusic
结束播放混音文件,释放播放文件
- (BOOL)stopPlayMusic
Discussion
结束播放混音文件,释放播放文件
Declared In
LSMediaCapture.h
– setMixIntensity:
设置混音强度
- (void)setMixIntensity:(int)value
Parameters
value |
混音强度范围【1-10】 默认为10,已经最大 |
---|
Discussion
设置混音强度
Declared In
LSMediaCapture.h
externalCaptureSampleBufferCallback
采集模块采集的视频数据回调,交由外部进行自定义前处理,处理完后通过externalInputSampleBuffer发送给sdk
@property (nonatomic, copy) void ( ^ ) ( CMSampleBufferRef sampleBuffer ) externalCaptureSampleBufferCallback
Discussion
采集模块采集的视频数据回调,交由外部进行自定义前处理,处理完后通过externalInputSampleBuffer发送给sdk
Declared In
LSMediaCapture.h
– externalInputSampleBuffer:
将外部前处理之后的视频数据发送给sdk
- (void)externalInputSampleBuffer:(CMSampleBufferRef)sampleBuffer
Parameters
sampleBuffer |
视频数据 |
---|
Discussion
将外部前处理之后的视频数据发送给sdk
Declared In
LSMediaCapture.h
externalCaptureAudioRawData
麦克风采集到的原始裸数据的回调,交由外部进行自定义处理,同步处理 param rawData 麦克风采集得到的裸数据,PCM格式
@property (nonatomic, copy) void ( ^ ) ( AudioBufferList *bufferList , NSInteger inNumberFrames ) externalCaptureAudioRawData
Discussion
麦克风采集到的原始裸数据的回调,交由外部进行自定义处理,同步处理 param rawData 麦克风采集得到的裸数据,PCM格式
Declared In
LSMediaCapture.h
– externalInputAudioBufferList:inNumberFrames:
用户可以通过这个接口,将第三方采集的音频数据送回来,数据的格式要保持不变,由视频云sdk推流出去
- (void)externalInputAudioBufferList:(AudioBufferList *)bufferList inNumberFrames:(NSInteger)inNumberFrames
Parameters
bufferList |
音频数据 |
---|---|
inNumberFrames |
frames数据 |
Discussion
用户可以通过这个接口,将第三方采集的音频数据送回来,数据的格式要保持不变,由视频云sdk推流出去
Declared In
LSMediaCapture.h
– startSpeedCalc:success:fail:
开始测速
- (void)startSpeedCalc:(NSString *)url success:(void ( ^ ) ( NSMutableArray *array ))success fail:(void ( ^ ) ( void ))fail
Discussion
开始测速
Declared In
LSMediaCapture.h
– setSpeedCacl:Capacity:
测速之前设置测速次数和上传数据大小
- (void)setSpeedCacl:(NSInteger)count Capacity:(unsigned long long)capacity
Parameters
count |
测速次数(默认为1次),测速之后,取平均值返回结果 |
---|---|
capacity |
上传数据大小(仅限于文件上传类型,经测试,NTS2不能超过500k(含500k)),单位是字节,500k=500*1024,默认为499k(控制最大不超过10M) |
Discussion
测速之前设置测速次数和上传数据大小
Declared In
LSMediaCapture.h
flash
flash摄像头
@property (nonatomic, assign) BOOL flash
Return Value
打开或者关闭摄像头flash
Discussion
flash摄像头
Declared In
LSMediaCapture.h
maxZoomScale
摄像头变焦功能属性:最大拉伸值,系统最大为:videoMaxZoomFactor
@property (nonatomic, assign, readonly) CGFloat maxZoomScale
Discussion
摄像头变焦功能属性:最大拉伸值,系统最大为:videoMaxZoomFactor
Warning: iphone4s以及之前的版本,videoMaxZoomFactor=1;不支持拉伸
Declared In
LSMediaCapture.h
zoomScale
摄像头变焦功能属性:拉伸值,[1,maxZoomScale]
@property (nonatomic, assign) CGFloat zoomScale
Discussion
摄像头变焦功能属性:拉伸值,[1,maxZoomScale]
Warning: iphone4s以及之前的版本,videoMaxZoomFactor=1;不支持拉伸
Declared In
LSMediaCapture.h
onZoomScaleValueChanged
摄像头变焦功能属性:拉伸值变化回调block
@property (nonatomic, copy) void ( ^ ) ( CGFloat value ) onZoomScaleValueChanged
Discussion
摄像头变焦功能属性:拉伸值变化回调block
摄像头响应uigesture事件,而改变了拉伸系数反馈
Warning: iphone4s以及之前的版本,videoMaxZoomFactor=1;不支持拉伸
Declared In
LSMediaCapture.h
– switchCamera:
切换前后摄像头
- (LSCameraPosition)switchCamera:(LSSwitchModuleVideoCameraPositionBlock)cameraPostionBlock
Return Value
当前摄像头的位置,前或者后
Discussion
切换前后摄像头
Declared In
LSMediaCapture.h
– switchVideoStreamingQuality:block:
切换分辨率,支持直播过程中切换分辨率,切换分辨率,水印将自动清除,需要外部根据分辨率,再次设置水印大小
- (BOOL)switchVideoStreamingQuality:(LSVideoStreamingQuality)videoResolution block:(LSVideoStreamingQualityBlock)videoResolutionBlock
Parameters
videoResolution |
分辨率 |
---|---|
videoResolutionBlock |
回调 |
Discussion
切换分辨率,支持直播过程中切换分辨率,切换分辨率,水印将自动清除,需要外部根据分辨率,再次设置水印大小
Declared In
LSMediaCapture.h
– setBitrate:fps:cameraOrientation:
直播推流之前设置如下参数
- (void)setBitrate:(int)bitrate fps:(int)fps cameraOrientation:(LSCameraOrientation)cameraOrientation
Parameters
bitrate |
推流码率 default会按照分辨率设置 |
---|---|
fps |
采集帧率 default = 15 |
cameraOrientation |
摄像头采集方向(一般不变) |
Discussion
直播推流之前设置如下参数
Declared In
LSMediaCapture.h
– changeIsFrontPreViewMirrored
切换本地预览镜像
- (BOOL)changeIsFrontPreViewMirrored
Return Value
当前是否镜像
Discussion
切换本地预览镜像
Declared In
LSMediaCapture.h
– changeIsFrontCodeMirrored
切换编码镜像(针对拉流端观众)
- (BOOL)changeIsFrontCodeMirrored
Return Value
当前是否镜像
Discussion
切换编码镜像(针对拉流端观众)
Declared In
LSMediaCapture.h
– snapShotWithCompletionBlock:
获取视频截图,
- (void)snapShotWithCompletionBlock:(LSFrameCaptureCompletionBlock)completionBlock
Parameters
completionBlock |
获取最新一幅视频图像的回调 |
---|
Discussion
获取视频截图,
Declared In
LSMediaCapture.h
– setFilterType:
设置滤镜类型
- (void)setFilterType:(LSGpuImageFilterType)filterType
Parameters
filterType |
滤镜类型,目前支持4种滤镜,参考 LSGpuImageFilterType 描述 |
---|
Discussion
设置滤镜类型
Declared In
LSMediaCapture.h
– setSmoothFilterIntensity:
设置磨皮强度【0-1】
- (void)setSmoothFilterIntensity:(float)value
Parameters
value |
值 |
---|
Discussion
设置磨皮强度【0-1】
Declared In
LSMediaCapture.h
– setWhiteningFilterIntensity:
设置美白强度【0-1】
- (void)setWhiteningFilterIntensity:(float)value
Parameters
value |
值 |
---|
Discussion
设置美白强度【0-1】
Declared In
LSMediaCapture.h
– adjustExposure:
调节曝光度(-10.0 - 10.0 ,默认为0.0)
- (void)adjustExposure:(CGFloat)exposure
Parameters
exposure |
曝光度 |
---|
Discussion
调节曝光度(-10.0 - 10.0 ,默认为0.0)
Declared In
LSMediaCapture.h
– addGraffiti:rect:location:
添加涂鸦
- (void)addGraffiti:(UIImage *)image rect:(CGRect)rect location:(LSWaterMarkLocation)location
Parameters
image |
涂鸦静态图像 |
---|---|
rect |
具体位置和大小(x,y根据location位置,计算具体的位置信息) |
location |
位置 |
Discussion
添加涂鸦
Declared In
LSMediaCapture.h
– addWaterMark:rect:location:
添加静态视频水印
- (void)addWaterMark:(UIImage *)image rect:(CGRect)rect location:(LSWaterMarkLocation)location
Parameters
image |
静态图像 |
---|---|
rect |
具体位置和大小(x,y根据location位置,计算具体的位置信息) |
location |
位置 |
Discussion
添加静态视频水印
Declared In
LSMediaCapture.h
– closePreviewWaterMark:
关闭本地预览静态水印
- (void)closePreviewWaterMark:(BOOL)isClosed
Discussion
关闭本地预览静态水印
Declared In
LSMediaCapture.h
– addDynamicWaterMarks:fpsCount:loop:rect:location:
添加动态视频水印
- (void)addDynamicWaterMarks:(NSArray *)imageArray fpsCount:(unsigned int)count loop:(BOOL)looped rect:(CGRect)rect location:(LSWaterMarkLocation)location
Parameters
imageArray |
动态图像数组 |
---|---|
count |
播放速度的快慢:count代表count帧显示同一张图 |
looped |
是否循环,不循环就显示一次 |
rect |
具体位置和大小(x,y根据location位置,计算具体的位置信息) |
location |
位置 |
Discussion
添加动态视频水印
Declared In
LSMediaCapture.h
– closePreviewDynamicWaterMark:
关闭本地预览动态水印
- (void)closePreviewDynamicWaterMark:(BOOL)isClosed
Discussion
关闭本地预览动态水印
Declared In
LSMediaCapture.h