JDLive Class Reference
Inherits from | NSObject |
---|---|
Declared in | JDLive.h |
– initWithConfig:
初始化配置类
- (instancetype)initWithConfig:(JDLConfig *)config
Parameters
config |
配置类对象 |
---|
Return Value
JDLive实例
Declared In
JDLive.h
– setLiveDelegate:
推流回调代理
- (void)setLiveDelegate:(id<JDLiveDelegate>)delegate
Parameters
delegate |
推流代理回调 |
---|
Discussion
see JDLiveDelegate
Declared In
JDLive.h
+ isCanSetSessionPreset:withCameraPosition:
查询摄像头是否支持预览
+ (BOOL)isCanSetSessionPreset:(NSString *)sessionPreset withCameraPosition:(AVCaptureDevicePosition)cameraPosition
Parameters
sessionPreset |
分辨率 |
---|---|
cameraPosition |
摄像头 |
Return Value
YES:支持 NO:不支持
Declared In
JDLive.h
– startPreview:
开始预览
- (void)startPreview:(UIView *)view
Parameters
view |
传入预览,内部预览view将加到view上 |
---|
Declared In
JDLive.h
– isCaptureRunning
是否在录制
- (BOOL)isCaptureRunning
Return Value
YES:正在录制 NO:没有录制
Declared In
JDLive.h
– getCurrentDevicePosition
获取当前摄像头状态
- (AVCaptureDevicePosition)getCurrentDevicePosition
Return Value
AVCaptureDevicePosition:前置 后置
Declared In
JDLive.h
– getCurrentCaptureCamera
获取当前相机
- (AVCaptureDevice *)getCurrentCaptureCamera
Return Value
AVCaptureDevice:当前相机
Declared In
JDLive.h
– isFlashLightSupported
闪光灯是否支持
- (BOOL)isFlashLightSupported
Return Value
YES:支持 NO:不支持
Declared In
JDLive.h
– setVideoZoomFactor:
设置视频缩放因子
- (void)setVideoZoomFactor:(CGFloat)factor
Parameters
factor |
因子数 |
---|
Declared In
JDLive.h
– setCaptureFocusPoint:FocusMode:
摄像头自动变焦
- (BOOL)setCaptureFocusPoint:(CGPoint)point FocusMode:(AVCaptureFocusMode)mode
Parameters
point |
变焦位置 |
---|---|
mode |
变焦类型 |
Return Value
YES:成功变焦 NO:变焦失败
Declared In
JDLive.h
– setCaptureExposureAtPoint:
摄像头自动曝光
- (BOOL)setCaptureExposureAtPoint:(CGPoint)point
Parameters
point |
曝光位置 |
---|
Return Value
YES:成功曝光 NO:曝光失败
Declared In
JDLive.h
– setCaptureWhiteBalance
摄像头白平衡
- (BOOL)setCaptureWhiteBalance
Return Value
YES:成功 NO:失败
Declared In
JDLive.h
– getCaptureDimensions
获取摄像头分辨率
- (CGSize)getCaptureDimensions
Return Value
分辨率
Declared In
JDLive.h
– setPushStreamUrl:
设置推流地址
- (void)setPushStreamUrl:(NSURL *)url
Parameters
url |
地址 |
---|
Declared In
JDLive.h
– processReplayKitSampleBuffer:withSampleType:
录屏数据传入接口
- (void)processReplayKitSampleBuffer:(CMSampleBufferRef)sample withSampleType:(int)type
Parameters
sample |
CMSampleBufferRef |
---|---|
type |
RPSampleBufferType |
Declared In
JDLive.h
– getPushStreamState
获取推流状态
- (JDLPushStreamState)getPushStreamState
Return Value
JDLStreamState
Declared In
JDLive.h
– isPushStreaming
查询当前是否在推流 (建立连接中, 或连接中)
- (BOOL)isPushStreaming
Return Value
YES:推流中 NO:推流中
Declared In
JDLive.h
– setPushStreamAudioOnly:
设置获取是否仅推音频数据,视频画面发送最后一帧
- (void)setPushStreamAudioOnly:(BOOL)isAudioOnly
Parameters
isAudioOnly |
YES:开启此功能 NO:不开启此功能 |
---|
Declared In
JDLive.h
– getPushStreamAudioOnly
获取是否仅推音频数据,视频画面发送最后一帧
- (BOOL)getPushStreamAudioOnly
Return Value
YES:开启此功能 NO:不开启此功能
Declared In
JDLive.h
– startBGImagePushStream:
开始背景图+音频推流
- (void)startBGImagePushStream:(UIImage *)image
Parameters
image |
背景图 |
---|
Declared In
JDLive.h
– startUIViewPushStream:
开始UIView+音频推流
- (void)startUIViewPushStream:(UIView *)view
Parameters
view |
用于推流的UIView |
---|
Declared In
JDLive.h
– startFloatingPreview:
开始悬浮窗口预览
- (void)startFloatingPreview:(UIView *)floatView
Parameters
floatView |
传入悬浮窗 |
---|
Declared In
JDLive.h
– setVideoPreviewOrientation:
设置预览屏幕方向
- (void)setVideoPreviewOrientation:(UIInterfaceOrientation)orie
Parameters
orie |
预览屏幕方向 |
---|
Declared In
JDLive.h
– getVideoPreviewOrientation
获取预览屏幕方向
- (UIInterfaceOrientation)getVideoPreviewOrientation
Return Value
UIInterfaceOrientation 预览屏幕方向
Declared In
JDLive.h
– setVideoPushStreamOrientation:
设置推流屏幕方向
- (void)setVideoPushStreamOrientation:(UIInterfaceOrientation)orie
Parameters
orie |
推流屏幕方向 |
---|
Declared In
JDLive.h
– getVideoPushStreamOrientation
获取推流屏幕方向
- (UIInterfaceOrientation)getVideoPushStreamOrientation
Return Value
UIInterfaceOrientation 推流屏幕方向
Declared In
JDLive.h
– isHeadsetPlugIn
是否插入耳机
- (BOOL)isHeadsetPlugIn
Return Value
YES:插入了耳机 NO:未插入耳机
Declared In
JDLive.h
– setAudioFoldbackEnable:
设置是否开启耳返
- (void)setAudioFoldbackEnable:(BOOL)enable
Parameters
enable |
YES:开启此功能 NO:不开启此功能(默认) |
---|
Declared In
JDLive.h
– getAudioFoldbackEnable
获取是否开启耳返
- (BOOL)getAudioFoldbackEnable
Return Value
YES:开启此功能 NO:不开启此功能
Declared In
JDLive.h
– setAudioStreamStereoEnable:
设置是否立体声推流
- (void)setAudioStreamStereoEnable:(BOOL)enable
Parameters
enable |
YES:开启此功能 NO:不开启此功能(默认) |
---|
Declared In
JDLive.h
– getAudioStreamStereoEnable
获取是否立体声推流
- (BOOL)getAudioStreamStereoEnable
Return Value
YES:开启此功能 NO:不开启此功能
Declared In
JDLive.h
– setAudioStreamMute:
设置是否静音推流
- (void)setAudioStreamMute:(BOOL)mute
Parameters
mute |
YES:静音 NO:不静音(默认) |
---|
Declared In
JDLive.h
– getAudioStreamMute
获取是否静音推流
- (BOOL)getAudioStreamMute
Return Value
YES:静音 NO:不静音
Declared In
JDLive.h
– setInputAudioDeviceType:
设置输入音频设备类型
- (void)setInputAudioDeviceType:(JDLAudioDeviceType)type
Parameters
type |
设备类型 |
---|
Declared In
JDLive.h
– getInputAudioDeviceType
获取输入音频设备类型
- (JDLAudioDeviceType)getInputAudioDeviceType
Return Value
JDLAudioDeviceType 设备类型
Declared In
JDLive.h
– setAudioReverbType:
设置音频混响类型
- (void)setAudioReverbType:(int)type
Parameters
type |
0关闭(默认)1录音棚 2演唱会 3KTV 4小舞台 |
---|
Declared In
JDLive.h
– getAudioReverbType
获取音频混响类型
- (int)getAudioReverbType
Return Value
type(int 0关闭(默认)1录音棚 2演唱会 3KTV 4小舞台)
Declared In
JDLive.h
– setAudioEffectType:
设置音频变声效果类型
- (void)setAudioEffectType:(int)type
Parameters
type |
(int 0原声(默认)1大叔 2萝莉 3宏大 4机器人) |
---|
Declared In
JDLive.h
– getAudioEffectType
获取音频变声效果类型
- (int)getAudioEffectType
Return Value
type (int 0原声(默认)1大叔 2萝莉 3宏大 4机器人)
Declared In
JDLive.h
– setAudioEffectCustomFlag:
设置音频自定义升降调效果类型
- (void)setAudioEffectCustomFlag:(int)flag
Parameters
flag |
int -3 ~ 3 |
---|
Declared In
JDLive.h
– getAudioEffectCustomFlag
获取音频自定义升降调效果类型
- (int)getAudioEffectCustomFlag
Return Value
flag int 0-7
Declared In
JDLive.h
– setAudioNoiseHandleParam:
设置噪声处理参数
- (void)setAudioNoiseHandleParam:(int)param
Parameters
param |
0关闭(默认)1-4 |
---|
Declared In
JDLive.h
– getAudioNoiseHandleParam
获取噪声处理参数
- (int)getAudioNoiseHandleParam
Return Value
0关闭(默认)1-4
Declared In
JDLive.h
– setAudioFoldbackVolume:
设置耳返回音量
- (void)setAudioFoldbackVolume:(CGFloat)vol
Parameters
vol |
0-1.0 |
---|
Declared In
JDLive.h
– getAudioFoldbackVolume
获取耳返回音量
- (CGFloat)getAudioFoldbackVolume
Return Value
0-1.0
Declared In
JDLive.h
– setAudioMixEnable:withTrackId:
设置音轨混合是否开启
- (void)setAudioMixEnable:(BOOL)enable withTrackId:(int)trackId
Parameters
enable |
YES:开启此功能 NO:不开启此功能 |
---|---|
trackId |
0麦克风 1背景音乐 |
Declared In
JDLive.h
– isAudioMixEnableWithTrackId:
获取音轨混合是否开启
- (BOOL)isAudioMixEnableWithTrackId:(int)trackId
Parameters
trackId |
0麦克风 1背景音乐 |
---|
Return Value
YES:开启此功能 NO:不开启此功能
Declared In
JDLive.h
– setAudioMixVolume:withTrackId:
设置混音音量
- (void)setAudioMixVolume:(CGFloat)vol withTrackId:(int)trackId
Parameters
vol |
0-2.0 |
---|---|
trackId |
0麦克风 1背景音乐 |
Declared In
JDLive.h
– getAudioMixVolumeWithTrackId:
获取混音音量
- (CGFloat)getAudioMixVolumeWithTrackId:(int)trackId
Parameters
trackId |
0麦克风 1背景音乐 |
---|
Return Value
vol: 0-2.0
Declared In
JDLive.h
– startBGMusic:
开始播放背景音乐
- (void)startBGMusic:(NSString *)audioPath
Parameters
audioPath |
本地音乐文件 |
---|
Declared In
JDLive.h
– stopBGMusicWithComplete:
停止播放背景音乐
- (void)stopBGMusicWithComplete:(void ( ^ ) ( void ))completion
Parameters
completion |
完成停止音乐的回调 |
---|
Declared In
JDLive.h
– setBGMusicFinishBlock:
设置播放完成回调
- (void)setBGMusicFinishBlock:(void ( ^ ) ( void ))block
Parameters
block |
播放完成回调 |
---|
Declared In
JDLive.h
– setBGMusicStateChangeBlock:
设置播放状态改变回调
- (void)setBGMusicStateChangeBlock:(void ( ^ ) ( void ))block
Parameters
block |
状态改变回调 |
---|
Declared In
JDLive.h
– seekBGMusicToTime:withComplete:
seek到指定时间 (拖动进度条)
- (void)seekBGMusicToTime:(CGFloat)time withComplete:(void ( ^ ) ( BOOL ))completion
Parameters
time |
指定时间(单位,秒) |
---|---|
completion |
回调 |
Declared In
JDLive.h
– setBGMusicPlayRate:
设置播放速率
- (void)setBGMusicPlayRate:(CGFloat)playRate
Parameters
playRate |
调整范围 0.5 ~ 2.0,默认值 1.0 |
---|
Declared In
JDLive.h
– getBGMusicPlayRate
获取播放速率
- (CGFloat)getBGMusicPlayRate
Return Value
调整范围 0.5 ~ 2.0,默认值 1.0
Declared In
JDLive.h
– setBGMusicVolume:
设置背景音乐播放音量
- (void)setBGMusicVolume:(CGFloat)volume
Parameters
volume |
调整范围 0.0~1.0 |
---|
Declared In
JDLive.h
– getBGMusicVolume
获取背景音乐播放音量
- (CGFloat)getBGMusicVolume
Return Value
volume 调整范围 0.0~1.0
Declared In
JDLive.h
– setBGMusicMute:
设置背景音乐播放静音,推流还有音量
- (void)setBGMusicMute:(BOOL)mute
Parameters
mute |
YES:静音 NO:不静音(默认) |
---|
Declared In
JDLive.h
– getBGMusicMute
获取背景音乐播放静音,推流还有音量
- (BOOL)getBGMusicMute
Return Value
YES:静音 NO:不静音(默认)
Declared In
JDLive.h
– getBGMusicState
获取背景音乐播放状态
- (JDLBGMusicPlayerState)getBGMusicState
Return Value
JDLBGMusicPlayerState 背景音乐播放状态
Declared In
JDLive.h
– getBGMusicDuration
获取背景音乐总时长
- (CGFloat)getBGMusicDuration
Return Value
总时长 (单位,秒)
Declared In
JDLive.h
– getBGMusicCurrentPlayTime
获取背景音乐当前播放时间点
- (CGFloat)getBGMusicCurrentPlayTime
Return Value
时间点(单位,秒)
Declared In
JDLive.h
– setPreviewHFlip:
设置预览图像水平反转
- (void)setPreviewHFlip:(BOOL)flip
Parameters
flip |
YES:左右反转 NO:正常(默认) |
---|
Declared In
JDLive.h
– getPreviewHFlip
获取预览图像水平反转
- (BOOL)getPreviewHFlip
Return Value
YES:左右反转 NO:正常(默认)
Declared In
JDLive.h
– setPushStreamHFlip:
设置推流图像水平反转
- (void)setPushStreamHFlip:(BOOL)flip
Parameters
flip |
YES:左右反转 NO:正常(默认) |
---|
Declared In
JDLive.h
– getPushStreamHFlip
获取推流图像水平反转
- (BOOL)getPushStreamHFlip
Return Value
YES:左右反转 NO:正常(默认)
Declared In
JDLive.h
– setVideoBeautyWhiteLevel:
设置美颜等级接口
- (void)setVideoBeautyWhiteLevel:(int)level
Parameters
level |
0 to 5 default=0 |
---|
Declared In
JDLive.h
– getVideoBeautyWhiteLevel
获取美颜等级接口
- (int)getVideoBeautyWhiteLevel
Return Value
0 to 5 default=0
Declared In
JDLive.h
– setVideoFilterEffectIndex:
设置滤镜效果接口
- (void)setVideoFilterEffectIndex:(int)index
Parameters
index |
0 to 5 default=0 |
---|
Declared In
JDLive.h
– getVideoFilterEffectIndex
获取滤镜效果接口
- (int)getVideoFilterEffectIndex
Return Value
0 to 5 default=0
Declared In
JDLive.h
– setVideoFilterEffectFile:
设置滤镜效果接口
- (void)setVideoFilterEffectFile:(NSString *)strFile
Parameters
strFile |
滤镜文件全路径 default = nil |
---|
Declared In
JDLive.h
– getVideoFilterEffectFile
获取滤镜效果接口
- (NSString *)getVideoFilterEffectFile
Return Value
strFile 滤镜文件全路径
Declared In
JDLive.h
– startMediaRecord:
开始录制视频
- (BOOL)startMediaRecord:(NSURL *)url
Parameters
url |
本地录制路径 |
---|
Return Value
YES:成功 NO:失败
Declared In
JDLive.h
– getMediaRecordDuration
获取录制视频时长
- (double)getMediaRecordDuration
Return Value
时长
Declared In
JDLive.h
– getMediaRecordState
获取录制视频状态
- (JDLMediaRecordState)getMediaRecordState
Return Value
JDLMediaRecordState 录制视频状态
Declared In
JDLive.h
– snapshotFromStreamWithCompletion:
从推流编码之前的图像中截取一张
- (void)snapshotFromStreamWithCompletion:(void ( ^ ) ( UIImage *))completion
Parameters
completion |
通过完成代码块获取到截图完成的图像 |
---|
Declared In
JDLive.h
– addWaterWithImage:rect:rotation:alpha:rotationMode:
添加图片水印 一个图片
- (int)addWaterWithImage:(UIImage *)image rect:(CGRect)rect rotation:(CGFloat)rotation alpha:(CGFloat)alpha rotationMode:(JDLRotationMode)rotationMode
Parameters
image |
水印图片 |
---|---|
rect |
水印位置0~1 |
rotation |
旋转角(单位:弧度) |
alpha |
透明度 |
rotationMode |
水印方向 |
Return Value
水印图层号
Declared In
JDLive.h
– addWaterWithImageList:duration:rect:rotation:alpha:rotationMode:
添加图片水印 一组图片
- (int)addWaterWithImageList:(NSArray<UIImage*> *)imageList duration:(CGFloat)duration rect:(CGRect)rect rotation:(CGFloat)rotation alpha:(CGFloat)alpha rotationMode:(JDLRotationMode)rotationMode
Parameters
imageList |
水印图片数组 |
---|---|
duration |
动图总时长 |
rect |
水印位置0~1 |
rotation |
旋转角(单位:弧度) |
alpha |
透明度 |
rotationMode |
水印方向 |
Return Value
水印图层号
Declared In
JDLive.h
– addTextWithView:rect:rotation:alpha:rotationMode:
添加文字水印 一个图片
- (int)addTextWithView:(UIView *)view rect:(CGRect)rect rotation:(CGFloat)rotation alpha:(CGFloat)alpha rotationMode:(JDLRotationMode)rotationMode
Parameters
view |
文字水印图片 |
---|---|
rect |
水印位置0~1 |
rotation |
旋转角(单位:弧度) |
alpha |
透明度 |
rotationMode |
水印方向 |
Return Value
水印图层号
Declared In
JDLive.h
– addTimestampWithLabel:rect:rotation:alpha:rotationMode:
添加时间戳水印
- (int)addTimestampWithLabel:(UILabel *)label rect:(CGRect)rect rotation:(CGFloat)rotation alpha:(CGFloat)alpha rotationMode:(JDLRotationMode)rotationMode
Parameters
label |
时间戳水印文本 |
---|---|
rect |
水印位置0~1 |
rotation |
旋转角(单位:弧度) |
alpha |
透明度 |
rotationMode |
水印方向 |
Return Value
水印图层号
Declared In
JDLive.h
– addUIViewWithView:rect:rotation:alpha:rotationMode:
添加View作为图层
- (int)addUIViewWithView:(UIView *)view rect:(CGRect)rect rotation:(CGFloat)rotation alpha:(CGFloat)alpha rotationMode:(JDLRotationMode)rotationMode
Parameters
view |
作为图层的view |
---|---|
rect |
水印位置0~1 |
rotation |
旋转角(单位:弧度) |
alpha |
透明度 |
rotationMode |
水印方向 |
Return Value
水印图层号
Declared In
JDLive.h
– removeLayerWithId:
去除图层
- (void)removeLayerWithId:(int)layerId
Parameters
layerId |
图层号 |
---|
Declared In
JDLive.h
+ processEffectImageWithLookUpImagePath:preImage:
处理图片
+ (UIImage *)processEffectImageWithLookUpImagePath:(NSString *)lookUpImagePath preImage:(UIImage *)preImage
Parameters
lookUpImagePath |
外部滤镜文件路径 |
---|---|
preImage |
原始图像 |
Return Value
处理后图像
Declared In
JDLive.h
– sendUserCustomMessage:
发送用户自定义数据(通过SEI传输)
- (void)sendUserCustomMessage:(NSString *)message
Parameters
message |
自定义消息 长度小于4KB |
---|
Declared In
JDLive.h
– AddMixVideoStreamWithIndex:
加入一路混合视频流
- (void)AddMixVideoStreamWithIndex:(int)index
Parameters
index |
当前流索引 |
---|
Declared In
JDLive.h
– AddMixAudioStreamWithIndex:
加入一路混合音频流
- (void)AddMixAudioStreamWithIndex:(int)index
Parameters
index |
当前流索引 |
---|
Declared In
JDLive.h
– removeVideoStreamWithIndex:
移除一路混合视频流
- (void)removeVideoStreamWithIndex:(int)index
Parameters
index |
当前流索引 |
---|
Declared In
JDLive.h
– removeAudioStreamWithIndex:
移除一路混合音频流
- (void)removeAudioStreamWithIndex:(int)index
Parameters
index |
当前流索引 |
---|
Declared In
JDLive.h
– inputMixVideoSampleBuffer:streamIndex:
输入混合流视频流数据
- (void)inputMixVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer streamIndex:(int)index
Parameters
sampleBuffer |
视频帧数据 |
---|---|
index |
当前流索引 |
Declared In
JDLive.h
– inputMixAudioSampleBuffer:streamIndex:
输入混合流音频数据
- (void)inputMixAudioSampleBuffer:(CMSampleBufferRef)sampleBuffer streamIndex:(int)index
Parameters
sampleBuffer |
音频帧数据 |
---|---|
index |
当前流索引 |
Declared In
JDLive.h
– setBeforeMixVideoOutputSampleBufferCallback:
输出混合前视频数据
- (void)setBeforeMixVideoOutputSampleBufferCallback:(void ( ^ ) ( CMSampleBufferRef ))beforeMixVideoOutputSampleBufferCallback
Parameters
beforeMixVideoOutputSampleBufferCallback |
回调函数 |
---|
Declared In
JDLive.h
– setBeforeMixAudioOutputSampleBufferCallback:
输出混合前音频数据
- (void)setBeforeMixAudioOutputSampleBufferCallback:(void ( ^ ) ( CMSampleBufferRef ))beforeMixAudioOutputSampleBufferCallback
Parameters
beforeMixAudioOutputSampleBufferCallback |
回调函数 |
---|
Declared In
JDLive.h