Skip to content

SRRoomAudio

Ju Liaoyuan edited this page Dec 20, 2022 · 1 revision

SRRoomAudio Class Reference

  Inherits from NSObject
  Declared in SRRoomAudio.h

SRRoomAudio.m

Tasks

Other Methods

– initWithTuple:

– setAudioPrep:

– removeAudioPrep:

– enableMic

– unableMic

– enableSpeaker

– unableSpeaker

– muteWithIdArr:

– muteWithId:

– unMuteWithIdArr:

– unMuteWithId:

– startPullSpecificWithModel:

– stopPullSpecificWithModel:

– isPullingSignal

– isPublishingSignal

– isPullingWithId:

– pullingAccIdSet

– startPublish

– stopPublish

– startPullAllId

– stopPullAllId

– startPullWithId:

– startPullWithIdArr:

– stopPullWithId:

– stopPullWithIdArr:

– setReverbMode:

– disableLoopback

– muteStreamUserWithModel:

– unMuteStreamUserWithModel:

– volumeSubject

– disconnectSubject

– reconnectSubject

– voiceApertureSubject

– publishEventCallback

– getCaptureVolume

– setCaptureVolume:

– setLoopbackVolume:

– setStreamRenderView:

– updateConfigWithModel:

– videoFirstRenderCallback

– onKictOutRoom

– switchToVideo:

– switchToAudio

– onPullStreamFail

– onPullStreamSuccess

– onPublishStreamFail

– onPublishStreamSuccess

– sendSEIMessageWithDataDict:

– setDeviceMode:

Other Methods

  isOnlyCurrent property

Extension Methods

  isPublishByRisk property

  streamId property

Properties

isOnlyCurrent

是否只拉取当前房间内流 默认为NO, 可跨房间拉流连麦 设置为YES时, 只拉取本房间流

@property (nonatomic, assign) BOOL isOnlyCurrent

Discussion

是否只拉取当前房间内流 默认为NO, 可跨房间拉流连麦 设置为YES时, 只拉取本房间流

Declared In

  • SRRoomAudio.h

isPublishByRisk

是否可以由风控消息开启推流

@property (nonatomic, assign) BOOL isPublishByRisk

Discussion

是否可以由风控消息开启推流

Declared In

  • SRRoomAudio.m

streamId

推流用stream id

@property (nonatomic, copy) NSString *streamId

Discussion

推流用stream id

Declared In

  • SRRoomAudio.m

Instance Methods

disableLoopback

关闭耳返(仅支持有线耳机)

- (BOOL)disableLoopback

Return Value

是否成功

Discussion

关闭耳返(仅支持有线耳机)

Declared In

  • SRRoomAudio.h

disconnectSubject

音频断开连接

- (RACSubject *)disconnectSubject

Discussion

音频断开连接

Declared In

  • SRRoomAudio.h

enableMic

开麦克

- (RACSignal *)enableMic

Return Value

返回SNCode

Discussion

开麦克

Declared In

  • SRRoomAudio.h

enableSpeaker

使用扬声器

- (RACSignal *)enableSpeaker

Discussion

使用扬声器

Declared In

  • SRRoomAudio.h

getCaptureVolume

获取采集音量,范围[0, 200],默认100

- (NSInteger)getCaptureVolume

Discussion

获取采集音量,范围[0, 200],默认100

Declared In

  • SRRoomAudio.h

initWithTuple:

初始化方法

- (instancetype)initWithTuple:(RACTuple *)*tuple*

Parameters

tuple
   初始化元组, 包含sdk与config model

Return Value

实例

Discussion

初始化方法

Declared In

  • SRRoomAudio.h

isPublishingSignal

是否正在推流

- (RACSignal *)isPublishingSignal

Discussion

是否正在推流

Declared In

  • SRRoomAudio.h

isPullingSignal

是否正在拉流

- (RACSignal *)isPullingSignal

Discussion

是否正在拉流

Declared In

  • SRRoomAudio.h

isPullingWithId:

是否正在拉取该流

- (BOOL)isPullingWithId:(NSString *)*idStr*

Parameters

idStr
   流id

Discussion

是否正在拉取该流

Declared In

  • SRRoomAudio.h

muteStreamUserWithModel:

网络请求 根据accId静音指定用户, 后台发送消息到房间内其他用户, 同时静音

- (RACSignal *)muteStreamUserWithModel:(SRMuteStreamUserModel *)*model*

Parameters

model
   参数model

Discussion

网络请求 根据accId静音指定用户, 后台发送消息到房间内其他用户, 同时静音

Declared In

  • SRRoomAudio.h

muteWithId:

静音流

- (RACSignal *)muteWithId:(NSString *)*idStr*

Parameters

idStr
   流Id

Return Value

返回SNCode

Discussion

静音流

Declared In

  • SRRoomAudio.h

muteWithIdArr:

静音流

- (RACSignal *)muteWithIdArr:(NSArray<NSString*> *)*idArr*

Parameters

idArr
   stream 流Id数组

Discussion

静音流

Declared In

  • SRRoomAudio.h

onKictOutRoom

用户被踢出房间

- (RACSubject *)onKictOutRoom

Return Value

踢出房间的错误code

Discussion

用户被踢出房间

Declared In

  • SRRoomAudio.h

onPublishStreamFail

推流失败,内部已经尝试重试但无法恢复,需要调用方主动发起重试。

- (RACSubject *)onPublishStreamFail

Return Value

元组,第一个值为sdkCode, 第二个值为一个json对象:streamId: 流id

Discussion

推流失败,内部已经尝试重试但无法恢复,需要调用方主动发起重试。

Declared In

  • SRRoomAudio.h

onPublishStreamSuccess

推流成功

- (RACSubject *)onPublishStreamSuccess

Return Value

streamId

Discussion

推流成功

Declared In

  • SRRoomAudio.h

onPullStreamFail

拉流失败,内部已经尝试重试但无法恢复,需要调用方主动发起重试。

- (RACSubject *)onPullStreamFail

Return Value

元组,第一个值为sdkCode, 第二个值为一个json对象:streamType: 流类型(1:混流,2:单流) streamId: 流id

Discussion

拉流失败,内部已经尝试重试但无法恢复,需要调用方主动发起重试。

Declared In

  • SRRoomAudio.h

onPullStreamSuccess

拉流成功

- (RACSubject *)onPullStreamSuccess

Return Value

streamId

Discussion

拉流成功

Declared In

  • SRRoomAudio.h

publishEventCallback

推流时间回调,事件参考 SNPublishEvent

- (RACSubject *)publishEventCallback

Discussion

推流时间回调,事件参考 SNPublishEvent

Declared In

  • SRRoomAudio.h

pullingAccIdSet

获取正在拉取流的accId 集合

- (NSSet<NSString*> *)pullingAccIdSet

Discussion

获取正在拉取流的accId 集合

Declared In

  • SRRoomAudio.h

reconnectSubject

音频重新连接成功

- (RACSubject *)reconnectSubject

Discussion

音频重新连接成功

Declared In

  • SRRoomAudio.h

removeAudioPrep:

移除音频预处理

- (void)removeAudioPrep:(id<SNAudioPrepProtocol>)*processor*

Discussion

移除音频预处理

Declared In

  • SRRoomAudio.h

sendSEIMessageWithDataDict:

发送SEI信令消息

- (void)sendSEIMessageWithDataDict:(NSDictionary *)*dataDict*

Discussion

发送SEI信令消息

Declared In

  • SRRoomAudio.h

setAudioPrep:

设置音频预处理类

- (void)setAudioPrep:(id<SNAudioPrepProtocol>)*processor*

Parameters

processor
   必须实现 SNAudioPrepProtocol 需保证在"推拉流/媒体播放器播放"前设置,推拉流后再次设置无效

Discussion

设置音频预处理类

Declared In

  • SRRoomAudio.h

setCaptureVolume:

设置采集音量,范围[0, 200]

- (void)setCaptureVolume:(NSInteger)*volume*

Discussion

设置采集音量,范围[0, 200]

Declared In

  • SRRoomAudio.h

setDeviceMode:

设置上麦模式

- (void)setDeviceMode:(SRDeviceMode)*mode*

Parameters

mode
   模式,参见 SRDeviceMode,默认是 SRDeviceModeGeneral

Discussion

设置上麦模式

Declared In

  • SRRoomAudio.h

setLoopbackVolume:

设置耳返音量,范围[0, 200]

- (void)setLoopbackVolume:(NSInteger)*volume*

Discussion

设置耳返音量,范围[0, 200]

Declared In

  • SRRoomAudio.h

setReverbMode:

设置音效

- (BOOL)setReverbMode:(SNVoiceReverbMode)*mode*

Parameters

mode
   参考 SNVoiceReverbMode

Return Value

是否设置成功

Discussion

设置音效

Declared In

  • SRRoomAudio.h

setStreamRenderView:

设置拉流时渲染视频的 view 可以为空,为空时,代表不再渲染视频 NOTE: 内部不会强持有该 view

- (void)setStreamRenderView:(UIView *)*view*

Discussion

设置拉流时渲染视频的 view 可以为空,为空时,代表不再渲染视频 NOTE: 内部不会强持有该 view

Declared In

  • SRRoomAudio.h

startPublish

开始推流 返回推流 id

- (RACSignal *)startPublish

Discussion

开始推流 返回推流 id

Declared In

  • SRRoomAudio.h

startPullAllId

拉取房间内所有流

- (RACSignal *)startPullAllId

Discussion

拉取房间内所有流

Declared In

  • SRRoomAudio.h

startPullSpecificWithModel:

网络请求 指定用户拉取指定流

- (RACSignal *)startPullSpecificWithModel:(SRSpecificStreamModel *)*model*

Parameters

model
   流模型

Discussion

网络请求 指定用户拉取指定流

Declared In

  • SRRoomAudio.h

startPullWithId:

开始拉流

- (RACSignal *)startPullWithId:(NSString *)*idStr*

Parameters

idStr
   streamId或accId

Discussion

开始拉流

Declared In

  • SRRoomAudio.h

startPullWithIdArr:

拉多条流

- (RACSignal *)startPullWithIdArr:(NSArray<NSString*> *)*idArr*

Parameters

idArr
   id数组

Return Value

返回SNCode

Discussion

拉多条流

Declared In

  • SRRoomAudio.h

stopPublish

停止推流

- (RACSignal *)stopPublish

Discussion

停止推流

Declared In

  • SRRoomAudio.h

stopPullAllId

停止所有现正在拉取流

- (RACSignal *)stopPullAllId

Discussion

停止所有现正在拉取流

Declared In

  • SRRoomAudio.h

stopPullSpecificWithModel:

网络请求 指定用户不拉取指定流

- (RACSignal *)stopPullSpecificWithModel:(SRSpecificNotStreamModel *)*model*

Parameters

model
   流模型

Discussion

网络请求 指定用户不拉取指定流

Declared In

  • SRRoomAudio.h

stopPullWithId:

停止拉流

- (RACSignal *)stopPullWithId:(NSString *)*idStr*

Parameters

idStr
   streamId或accId

Return Value

返回SNCode

Discussion

停止拉流

Declared In

  • SRRoomAudio.h

stopPullWithIdArr:

停止拉多条流

- (RACSignal *)stopPullWithIdArr:(NSArray<NSString*> *)*idArr*

Parameters

idArr
   id数组

Return Value

返回SNCode

Discussion

停止拉多条流

Declared In

  • SRRoomAudio.h

switchToAudio

将推流模式设置为纯音频

- (RACSignal *)switchToAudio

Discussion

将推流模式设置为纯音频

Declared In

  • SRRoomAudio.h

switchToVideo:

将推流模式设置为视频模式

- (RACSignal *)switchToVideo:(CGSize)*size*

Parameters

size
   视频宽高,不能为 0

Discussion

将推流模式设置为视频模式

Declared In

  • SRRoomAudio.h

unMuteStreamUserWithModel:

网络请求 根据accId取消静音指定用户, 后台发送消息到房间内其他用户, 同时取消静音

- (RACSignal *)unMuteStreamUserWithModel:(SRUnMuteStreamUserModel *)*model*

Parameters

model
   静音用户模型

Discussion

网络请求 根据accId取消静音指定用户, 后台发送消息到房间内其他用户, 同时取消静音

Declared In

  • SRRoomAudio.h

unMuteWithId:

取消静音流

- (RACSignal *)unMuteWithId:(NSString *)*idStr*

Parameters

idStr
   流Id

Return Value

返回SNCode

Discussion

取消静音流

Declared In

  • SRRoomAudio.h

unMuteWithIdArr:

取消静音流

- (RACSignal *)unMuteWithIdArr:(NSArray<NSString*> *)*idArr*

Parameters

idArr
   stream 流Id数组

Return Value

返回SNCode

Discussion

取消静音流

Declared In

  • SRRoomAudio.h

unableMic

关麦克

- (RACSignal *)unableMic

Return Value

返回SNCode

Discussion

关麦克

Declared In

  • SRRoomAudio.h

unableSpeaker

关闭扬声器, 使用听筒

- (RACSignal *)unableSpeaker

Discussion

关闭扬声器, 使用听筒

Declared In

  • SRRoomAudio.h

updateConfigWithModel:

更新配置

- (void)updateConfigWithModel:(SNConfigModel *)*model*

Discussion

更新配置

Declared In

  • SRRoomAudio.h

videoFirstRenderCallback

视频模式下,第一次开始渲染视频时的回调

- (RACSubject *)videoFirstRenderCallback

Discussion

视频模式下,第一次开始渲染视频时的回调

Declared In

  • SRRoomAudio.h

voiceApertureSubject

他人说话光圈回调

- (RACSignal *)voiceApertureSubject

Discussion

他人说话光圈回调

Declared In

  • SRRoomAudio.h

volumeSubject

推流音量回调

- (RACSubject *)volumeSubject

Discussion

推流音量回调

Declared In

  • SRRoomAudio.h
Clone this wiki locally