123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- //
- // XYChatRoomRTCManager.h
- // Starbuds
- //
- // Created by 翟玉磊 on 2020/7/9.
- // Copyright © 2020 翟玉磊. All rights reserved.
- //
- #import <Foundation/Foundation.h>
- NS_ASSUME_NONNULL_BEGIN
- @protocol XYChatRoomRTCManagerDelegate <NSObject>
- /// 当前混音播放状态改变
- - (void)playLocalAudioMixingStatusChange:(MusicPlayStatus)status musicId:(NSString *)musicId;
- /// key:streamId value:volume 0~100
- - (void)reportAudioVolumeIndicationOfSpeakers:(NSDictionary<NSString *, NSNumber *> *)speakers;
- @end
- @interface XYChatRoomRTCManager : NSObject
- @property (nonatomic, weak) id<XYChatRoomRTCManagerDelegate>delegate;
- /// 跨房PK房间Id
- @property (nonatomic, copy) NSString *kfPKRoomId;
- /// 跨房PK客场静音状态 YES静音
- @property (nonatomic, assign) BOOL kfPkMute;
- /// 加入房间
- /// @param roomId 房间id
- /// @param userId 用户id
- - (void)joinRoomWithRoomId:(NSString *)roomId userId:(NSString *)userId token:(NSString *)token resultBlock:(void(^)(NSInteger errCode, NSString *errMsg))block;
- /// 退出房间
- /// @param roomId 房间id
- /// @param block 回调
- - (void)exitRoomWithRoomId:(NSString *)roomId resultBlock:(void(^)(NSInteger errCode, NSString *errMsg))block;
- /// 开始推流 (streamId=roomId+userId)
- - (void)startPublishingStream:(NSString *)streamId roomId:(NSString *)roomId resultBlock:(void(^ _Nullable)(NSInteger errCode, NSString *errMsg))block;
- /// 停止推流
- - (void)stopPublishingStreamResultBlock:(void(^ _Nullable)(NSInteger errCode, NSString *errMsg))block;
- /// 检查音频输入是否静音
- - (BOOL)isSpeakerMuted;
- /// 是否静音(关闭音频输入) YES:表示静音音频输入关闭 NO:表示音频输入没有关闭
- - (void)muteSpeaker:(BOOL)mute;
- /// 检查麦克风是否关闭 YES关闭 NO开启
- - (BOOL)isMicrophoneMuted;
- /// 是否关闭麦克风 YES关闭 NO开启
- - (void)muteMicrophone:(BOOL)mute;
- /// 开/关音频采集设备 YES 表示打开音频采集设备;NO 表示关闭音
- - (void)enableAudioCaptureDevice:(BOOL)enable;
- /// 设置音频路由到扬声器
- /// @param defaultToSpeaker 是否使用内置扬声器播放声音,YES 表示使用内置扬声器播放声音,NO 表示使用当前系统调度的优先级最高的音频输出设备播放声音
- - (void)setAudioRouteToSpeaker:(BOOL)defaultToSpeaker;
- #pragma mark — 音乐播放管理
- /// 开始播放音乐文件
- /// @param filePath 指定需要混音的音频文件名和文件路径名,例如: /var/mobile/Containers/Data/audio.mp4。建议填写文件后缀名。若无法确定文件后缀名,可不填。支持以下音频格式: mp3,aac,m4a,3gp,wav
- - (void)startAudioMixing:(NSString * _Nonnull)filePath musicId:(nonnull NSString *)musicId;
- /// 停止播放音乐文件
- - (void)stopAudioMixing;
- /// 暂停播放音乐文件
- - (void)pauseAudioMixing;
- /// 恢复播放音乐文件
- - (void)resumeAudioMixing;
- /// 调节音乐文件的播放音量 该方法调节混音的音乐文件在本地和远端播放的音量大小。
- /// @param volume 音乐文件播放音量范围为 0~200。默认 100 为原始文件音量
- - (void)adjustAudioMixingVolume:(int)volume;
- /// 获取音乐文件的本地播放音量
- - (int)getAudioMixingPlayoutVolume;
- /// 获取音乐文件时长 单位为毫秒
- - (int)getAudioMixingDuration;
- /// 获取音乐文件播放进度,单位为毫秒。
- - (int)getAudioMixingCurrentPosition;
- /// 设置本地混响效果
- /// @param soundName 混响效果的名字 不传则说明是关闭
- - (void)setLocalVoiceReverbPresetName:(NSString *)soundName;
- - (void)clear;
- @end
- NS_ASSUME_NONNULL_END
|