JRTCSDK-iOS  v1.0.9
API文档
构造函数 | 类方法 | 属性 | 所有成员列表
JCMediaDevice类 参考

设备模块 更多...

构造函数

(JCMediaDeviceVideoCanvas *__nullable) - startCameraVideo:
 获得预览视频对象,通过此对象能获得视图用于UI显示 更多...
 
(JCMediaDeviceVideoCanvas *__nullable) - startCameraVideo:view:
 获得预览视频对象,通过此对象能获得视图用于UI显示 更多...
 
(JCMediaDeviceVideoCanvas *__nullable) - startVideo:renderType:
 获得预览视频对象,通过此对象能获得视图用于UI显示 更多...
 
(JCMediaDeviceVideoCanvas *__nullable) - startVideo:renderType:view:
 获得预览视频对象,通过此对象能获得视图用于UI显示 更多...
 
(void) - stopVideo:
 停止视频 更多...
 
(bool) - startAudio
 启动音频,一般正式开启通话前需要调用此接口 更多...
 
(bool) - stopAudio
 停止音频,一般在通话结束时调用 更多...
 
(bool) - startAudioInput
 打开音频输入设备 更多...
 
(bool) - stopAudioInput
 关闭音频输入设备 更多...
 
(bool) - startAudioOutput
 打开音频输出设备 更多...
 
(bool) - stopAudioOutput
 关闭音频输出设备 更多...
 
(bool) - startCamera
 
(bool) - stopCamera
 
(bool) - switchCamera
 
(bool) - switchCamera:
 
(void) - specifyCamera:
 
(void) - specifyCameraAngle:
 
(void) - setCameraProperty:height:framerate:
 
(void) - setScreenCaptureProperty:height:framerate:
 
(void) - setVideoAngle:
 
(bool) - isSpeakerOn
 获取扬声器状态 更多...
 
(void) - enableSpeaker:
 开启关闭扬声器 更多...
 
(bool) - enableScreenCapture:
 
(NSString *__nullable) - getAudioOutputType
 获得当前音频输出类型,如扬声器、听筒、耳机、蓝牙等 更多...
 
(bool) - startVideoFile
 开启视频文件作为视频输入源,文件和摄像头作为视频输入源只能存在一种,当前摄像头开启的话会关闭摄像头 更多...
 
(bool) - startScreenShareVideoFile
 开启屏幕共享作为视频输入源 更多...
 
(bool) - setVideoFileFrame:format:width:height:angle:
 向文件视频源逐帧添加视频数据 更多...
 
(void) - setVideoFileFrame:angle:mirror:
 向文件视频源逐帧添加视频数据 更多...
 
(bool) - startVideoCaptureRecord:captureId:fileType:width:height:
 开始视频录制 更多...
 
(bool) - stopVideoCaptureRecord:
 停止视频录制 更多...
 
(bool) - startAudioRecord:fileType:
 开始音频录制 更多...
 
(bool) - stopAudioRecord
 停止音频录制 更多...
 
(bool) - stopVideoFile
 关闭文件视频源 更多...
 
(void) - destroy
 销毁接口
 
(int) - getScreenFramerate
 获得当前屏幕共享帧率 更多...
 
(bool) - snapshotWithRenderId:path:
 
(void) - setAudioInputCallback:
 
(void) - setAudioOutputCallback:
 
(bool) - ringPlay:
 
(void) - ringStop
 

类方法

(JCMediaDevice *__nullable) + create:callback:
 创建 JCMediaDevice 对象 更多...
 

属性

id< AudioInputCallbackaudioInputCallback
 
id< AudioOutputCallbackaudioOutputCallback
 
bool isAudioInputStart
 
bool isAudioOutputStart
 
bool cameraOpen
 
bool videoFileOpen
 
JCMediaDeviceCameracurrentCamera
 
NSArray< JCMediaDeviceCamera * > * cameras
 
JCMediaDeviceCameradefaultCamera
 
JCMediaDeviceAudioParamaudioParam
 
NSString * videoFileId
 
bool audioInterrupt
 
JCMediaDeviceVideoAngle videoAngle
 
bool aec
 
bool useInternalAudioDeviceLogic
 
NSArray< JCMediaDeviceAudio * > * audioInputs
 
JCMediaDeviceAudioaudioInput
 
NSArray< JCMediaDeviceAudio * > * audioOutputs
 
JCMediaDeviceAudioaudioOutput
 
NSArray< JCMediaDeviceWindow * > * desktops
 
NSArray< JCMediaDeviceWindow * > * windows
 
JCMediaDeviceWindowscreenshareWindow
 
bool defaultSpeakerOn
 

详细描述

设备模块

函数文档

◆ create:callback:

+ (JCMediaDevice* __nullable) create: (JCClient *__nonnull)  client
callback: (id< JCMediaDeviceCallback > __nonnull)  callback 

创建 JCMediaDevice 对象

参数
clientJCClient 对象
callbackJCMediaDeviceCallback 回调接口,用于接收 JCMediaDevice 相关通知
返回
返回 JCMediaDevice 对象

◆ enableScreenCapture:

- (bool) enableScreenCapture: (bool)  enable

开启/关闭屏幕共享

参数
enable开启或关闭屏幕共享
  • true: 开启
  • false: 关闭
返回
调用是否成功
  • true:调用成功
  • false:调用失败

◆ enableSpeaker:

- (void) enableSpeaker: (bool)  enable

开启关闭扬声器

参数
enable是否开启

◆ getAudioOutputType

- (NSString* __nullable) getAudioOutputType

获得当前音频输出类型,如扬声器、听筒、耳机、蓝牙等

返回
当前音频输出类型

◆ getScreenFramerate

- (int) getScreenFramerate

获得当前屏幕共享帧率

返回
屏幕共享帧率

◆ isSpeakerOn

- (bool) isSpeakerOn

获取扬声器状态

返回
是开启还是关闭

◆ ringPlay:

- (bool) ringPlay: (NSString *__nonnull)  path

播放铃声

返回
是否成功
  • true 播放铃声成功
  • false 播放铃声失败

◆ ringStop

- (void) ringStop

停止铃声

◆ setAudioInputCallback:

- (void) setAudioInputCallback: (id< AudioInputCallback > _Nullable)  callback

设置音频输入帧回调

◆ setAudioOutputCallback:

- (void) setAudioOutputCallback: (id< AudioOutputCallback > _Nullable)  callback

设置音频输出帧回调

◆ setCameraProperty:height:framerate:

- (void) setCameraProperty: (int)  width
height: (int)  height
framerate: (int)  framerate 

@breif 设置摄像头采集属性

参数
width采集宽度,默认640
height采集高度,默认360
framerate帧速率,默认30

◆ setScreenCaptureProperty:height:framerate:

- (void) setScreenCaptureProperty: (int)  width
height: (int)  height
framerate: (int)  framerate 

@breif 设置屏幕共享采集属性

参数
width采集宽度,默认640
height采集高度,默认360
framerate帧速率,默认16

◆ setVideoAngle:

- (void) setVideoAngle: (JCMediaDeviceVideoAngle)  angle

@breif 设置视频窗体角度

参数
angle参看 JCMediaDeviceVideoAngle

◆ setVideoFileFrame:angle:mirror:

- (void) setVideoFileFrame: (CVPixelBufferRef __nonnull)  srcFrame
angle: (int)  angle
mirror: (int)  mirror 

向文件视频源逐帧添加视频数据

参数
CVPixelBufferRef视频数据
angle角度, 为 90 的倍数
mirror是否镜像,0 不镜像,1 镜像

◆ setVideoFileFrame:format:width:height:angle:

- (bool) setVideoFileFrame: (NSData *__nonnull)  srcFrame
format: (JCMediaDeviceVideoPixelFormat)  format
width: (int)  width
height: (int)  height
angle: (int)  angle 

向文件视频源逐帧添加视频数据

参数
srcFrame画面二进制数据
format视频像素格式
width
height
angle角度, 为 90 的倍数
返回
是否成功

◆ snapshotWithRenderId:path:

- (bool) snapshotWithRenderId: (NSString *__nonnull)  renderId
path: (NSString *__nonnull)  path 

截图

参数
renderId要截图的视频id
path要存放截图的文件路径
返回
是否成功
  • true 调用成功
  • false 调用失败

◆ specifyCamera:

- (void) specifyCamera: (JCMediaDeviceCamera *__nonnull)  camera

@breif 指定要开启的摄像头,在 startCamera 之前调用

参数
camera摄像头

◆ specifyCameraAngle:

- (void) specifyCameraAngle: (int)  angle

@breif 指定摄像头采集角度,为90的倍数

参数
angle角度

◆ startAudio

- (bool) startAudio

启动音频,一般正式开启通话前需要调用此接口

返回
成功返回 true,失败返回 false

◆ startAudioInput

- (bool) startAudioInput

打开音频输入设备

返回
成功返回 true,失败返回 false

◆ startAudioOutput

- (bool) startAudioOutput

打开音频输出设备

返回
成功返回 true,失败返回 false

◆ startAudioRecord:fileType:

- (bool) startAudioRecord: (NSString *_Nullable)  filePath
fileType: (JCAudioCaptureRecordFileType)  fileType 

开始音频录制

参数
filePath存储路径
fileType文件类型
返回
ture表示开启成功,false表示开启失败

◆ startCamera

- (bool) startCamera

@breif 开启摄像头

返回
成功返回 true,失败返回 false
参见
- startCamera

◆ startCameraVideo:

- (JCMediaDeviceVideoCanvas* __nullable) startCameraVideo: (JCMediaDeviceRender)  type

获得预览视频对象,通过此对象能获得视图用于UI显示

参数
type渲染模式,JCMediaDeviceRender
返回
JCMediaDeviceVideoCanvas 对象

◆ startCameraVideo:view:

- (JCMediaDeviceVideoCanvas* __nullable) startCameraVideo: (JCMediaDeviceRender)  type
view: (UIView *__nonnull)  view 

获得预览视频对象,通过此对象能获得视图用于UI显示

参数
type渲染模式,JCMediaDeviceRender
view视图view
返回
JCMediaDeviceVideoCanvas 对象

◆ startScreenShareVideoFile

- (bool) startScreenShareVideoFile

开启屏幕共享作为视频输入源

返回
是否成功

◆ startVideo:renderType:

- (JCMediaDeviceVideoCanvas* __nullable) startVideo: (NSString *__nonnull)  videoSource
renderType: (JCMediaDeviceRender)  type 

获得预览视频对象,通过此对象能获得视图用于UI显示

参数
videoSource渲染标识串,比如 JCMediaChannelParticipant JCCallItem 中的 renderId
type渲染模式,JCMediaDeviceRender
返回
JCMediaDeviceVideoCanvas 对象

◆ startVideo:renderType:view:

- (JCMediaDeviceVideoCanvas* __nullable) startVideo: (NSString *__nonnull)  videoSource
renderType: (JCMediaDeviceRender)  type
view: (UIView *__nonnull)  view 

获得预览视频对象,通过此对象能获得视图用于UI显示

参数
videoSource渲染标识串,比如 JCMediaChannelParticipant JCCallItem 中的 renderId,当videoSource 为 videoFileId 时,内部会调用 startVideoFile
type渲染模式,JCMediaDeviceRender
view视图view
返回
JCMediaDeviceVideoCanvas 对象

◆ startVideoCaptureRecord:captureId:fileType:width:height:

- (bool) startVideoCaptureRecord: (NSString *_Nonnull)  filePath
captureId: (NSString *_Nonnull)  captureId
fileType: (JCVideoCaptureRecordFileType)  fileType
width: (int)  width
height: (int)  height 

开始视频录制

参数
filePath存储路径
captureId捕获ID
fileType文件类型
width
height
返回
ture表示开启成功,false表示开启失败

◆ startVideoFile

- (bool) startVideoFile

开启视频文件作为视频输入源,文件和摄像头作为视频输入源只能存在一种,当前摄像头开启的话会关闭摄像头

返回
是否成功

◆ stopAudio

- (bool) stopAudio

停止音频,一般在通话结束时调用

返回
成功返回 true,失败返回 false

◆ stopAudioInput

- (bool) stopAudioInput

关闭音频输入设备

返回
成功返回 true,失败返回 false

◆ stopAudioOutput

- (bool) stopAudioOutput

关闭音频输出设备

返回
成功返回 true,失败返回 false

◆ stopAudioRecord

- (bool) stopAudioRecord

停止音频录制

返回
ture表示关闭成功,false表示关闭失败

◆ stopCamera

- (bool) stopCamera

@breif 关闭摄像头

返回
成功返回 true,失败返回 false

◆ stopVideo:

- (void) stopVideo: (JCMediaDeviceVideoCanvas *__nonnull)  canvas

停止视频

参数
canvasJCMediaDeviceVideoCanvas 对象,由 startVideo 获得

◆ stopVideoCaptureRecord:

- (bool) stopVideoCaptureRecord: (NSString *_Nonnull)  captureId

停止视频录制

参数
captureId捕获ID
返回
ture表示关闭成功,false表示关闭失败

◆ stopVideoFile

- (bool) stopVideoFile

关闭文件视频源

返回
ture表示关闭成功,false表示关闭失败

◆ switchCamera

- (bool) switchCamera

@breif 切换摄像头,内部会根据当前摄像头类型来进行切换

返回
成功返回 true,失败返回 false

◆ switchCamera:

- (bool) switchCamera: (JCMediaDeviceCamera *__nonnull)  camera

切换指定摄像头

参数
camera摄像头

属性说明

◆ aec

- (bool) aec
readwritenonatomicassign

回声消除,默认开启

◆ audioInput

- (JCMediaDeviceAudio*) audioInput
readwritenonatomicstrong

当前音频输入设备,mac 使用

◆ audioInputs

- (NSArray<JCMediaDeviceAudio*>*) audioInputs
readnonatomicassign

音频输入设备列表,mac 使用

◆ audioInterrupt

- (bool) audioInterrupt
readnonatomicassign

是否声音被中断

◆ audioOutput

- (JCMediaDeviceAudio*) audioOutput
readwritenonatomicstrong

当前音频输出设备,mac 使用

◆ audioOutputs

- (NSArray<JCMediaDeviceAudio*>*) audioOutputs
readnonatomicassign

音频输出设备列表,mac 使用

◆ audioParam

- (JCMediaDeviceAudioParam*) audioParam
readwritenonatomicstrong

音频参数

◆ cameraOpen

- (bool) cameraOpen
readnonatomicassign

摄像头是否打开

◆ cameras

- (NSArray<JCMediaDeviceCamera*>*) cameras
readnonatomicassign

摄像头列表

◆ currentCamera

- (JCMediaDeviceCamera*) currentCamera
readnonatomicassign

当前摄像头

◆ defaultCamera

- (JCMediaDeviceCamera*) defaultCamera
readwritenonatomicassign

默认摄像头

◆ defaultSpeakerOn

- (bool) defaultSpeakerOn
readwritenonatomicassign

没有插入耳机或外接蓝牙时是否默认开启扬声器

◆ desktops

- (NSArray<JCMediaDeviceWindow*>*) desktops
readnonatomicassign

桌面列表,mac 使用

◆ isAudioInputStart

- (bool) isAudioInputStart
readnonatomicassign

音频输入设备是否打开

◆ isAudioOutputStart

- (bool) isAudioOutputStart
readnonatomicassign

音频输出设备是否打开

◆ screenshareWindow

- (JCMediaDeviceWindow*) screenshareWindow
readwritenonatomicstrong

屏幕分享的窗口,mac 使用

◆ useInternalAudioDeviceLogic

- (bool) useInternalAudioDeviceLogic
readwritenonatomicassign

是否使用内部音频设备逻辑

1.打开扬声器 -> 使用扬声器输出声音 2.连上蓝牙耳机 -> 使用蓝牙耳机输出声音,如果扬声器开着则关闭扬声器 3.插入耳机 -> 使用耳机输出声音,如果扬声器开着则关闭扬声器 4.蓝牙耳机和有线耳机以最后连上的作为输出 5.关闭扬声器 -> (蓝牙耳机|有线耳机) > 听筒

◆ videoAngle

- (JCMediaDeviceVideoAngle) videoAngle
readwritenonatomicassign

视频角度

◆ videoFileId

- (NSString*) videoFileId
readnonatomicstrong

视频文件作为本地视频源的渲染标识

◆ videoFileOpen

- (bool) videoFileOpen
readnonatomicassign

文件播放是否打开

◆ windows

- (NSArray<JCMediaDeviceWindow*>*) windows
readnonatomicassign

窗口列表,mac 使用