202 lines
5.8 KiB
Objective-C
Executable File
202 lines
5.8 KiB
Objective-C
Executable File
//
|
||
// LNAgoraEngine.h
|
||
// SoundRiver
|
||
//
|
||
// Created by ln007 on 2019/8/29.
|
||
//
|
||
|
||
#import <Foundation/Foundation.h>
|
||
#import "QXSongListModel.h"
|
||
#import <AgoraRtcKit/AgoraMusicContentCenter.h>
|
||
#import <AgoraRtcKit/AgoraRtcEngineKit.h>
|
||
#import <AgoraRtcKit/AgoraRtcEngineKitEx.h>
|
||
NS_ASSUME_NONNULL_BEGIN
|
||
|
||
typedef NS_ENUM(NSInteger,PlayMusicTyper) {
|
||
MusicSingle,
|
||
MUsicRandomPlay,
|
||
MusicListPlay
|
||
};
|
||
|
||
typedef void(^SearchSongBlock)(NSArray<AgoraMusic *> *songList,BOOL isReload);
|
||
@protocol QXAgoraEngineMediaPlayerDelegate <NSObject>
|
||
/// 声浪回调
|
||
- (void)onRTCEngineRoomPublishSoundLevelUpdate:(NSArray<AgoraRtcAudioVolumeInfo *> *)soundLevels;
|
||
/// 播放器播放结束回调
|
||
- (void)rtcEngineLocalAudioMixingDidFinish;
|
||
/// 歌词回调
|
||
- (void)rtcEngineSongLrc:(NSString*)lrcUrl;
|
||
/// 歌曲进度回调
|
||
- (void)rtcEngineSongProgress:(NSUInteger)progress;
|
||
/// 背景音乐 下一首回调
|
||
- (void)rtcEngineBackgroundMusicNextSong:(QXSongListModel*)songModel;
|
||
/// 小黑屋电影首次加载
|
||
- (void)rtcEngineVideoFirstLoadWithUid:(NSInteger)uid size:(CGSize)size;
|
||
/// 小黑屋电影结束
|
||
- (void)rtcEngineVideoDidStop:(NSInteger)uid;
|
||
/// 开始
|
||
- (void)rtcEngineVideoDidStart:(NSInteger)uid;
|
||
@end
|
||
|
||
@interface QXAgoraEngine : NSObject
|
||
@property (nonatomic , strong) AgoraRtcEngineKit *agoraKit;
|
||
|
||
@property (nonatomic,weak) id<QXAgoraEngineMediaPlayerDelegate>delegate;
|
||
|
||
@property (nonatomic , strong, nullable) UIViewController *chatRoom;
|
||
|
||
|
||
|
||
@property (nonatomic,copy)SearchSongBlock searchSongBlock;
|
||
|
||
@property (nonatomic , strong,readonly)QXSongListModel *songModel;
|
||
|
||
/// 存储已点歌曲
|
||
@property (nonatomic , strong,readonly)NSMutableArray *bgMusicArray;
|
||
/// 是否为播放背景音乐状态
|
||
@property (nonatomic , assign)BOOL isPlayBgMusic;
|
||
|
||
// 循环/单曲/随机播放
|
||
@property (nonatomic,assign)PlayMusicTyper playType;
|
||
|
||
@property (nonatomic , strong) AgoraMusicContentCenter *ktvAmcc;
|
||
@property (nonatomic, strong) id<AgoraMusicPlayerProtocol> ktvPlayer;
|
||
@property(nonatomic, assign) NSInteger playPosition;//播放进度
|
||
@property(nonatomic, assign) BOOL isErfan;
|
||
|
||
/// 下面三个属性为k歌房使用
|
||
@property(nonatomic, assign,readonly) double renshengRatio;//采集音量,取值范围为 [0,400],默认100
|
||
@property(nonatomic, assign,readonly) double playerRatio;//采集音量,取值范围为 [0,400],默认100
|
||
//播放音效
|
||
@property (nonatomic, assign,readonly)AgoraAudioEffectPreset currentVoiceStyle;
|
||
@property(nonatomic, assign) BOOL useMicrophone;
|
||
|
||
/// 当前是否为开麦状态
|
||
@property(nonatomic, assign,readonly) BOOL isOpenMic;
|
||
|
||
|
||
+ (instancetype)sharedEngine;
|
||
|
||
//加入频道
|
||
- (void)joinChannel:(NSString *)channelId withRoom:(UIViewController *)chatRoom agora_token:(NSString*)agora_token agora_rtm_token:(NSString*)agora_rtm_token isUpSeat:(BOOL)isUpSeat successBock:(void(^)(void))successBock;
|
||
|
||
//切换频道
|
||
- (void)switchToChannel:(NSString *)channelId withRoom:(UIViewController *)chatRoom agora_token:(NSString*)agora_token agora_rtm_token:(NSString*)agora_rtm_token isUpSeat:(BOOL)isUpSeat successBock:(void(^)(void))successBock;
|
||
|
||
// 点唱初始化
|
||
- (void)onInitKTVCenterWithToken:(NSString*)token;
|
||
|
||
//离开频道
|
||
-(void)leaveChannel;
|
||
|
||
/// 销毁
|
||
- (void)destroyEngine;
|
||
|
||
//切换用户角色
|
||
/*
|
||
该方法在加入频道前后都可以调用:
|
||
|
||
加入直播频道前,调用该方法将用户设置为主播或观众。
|
||
直播过程中,调用该方法将用户角色由观众切换为主播(上麦),或由主播切换为观众。
|
||
*/
|
||
- (void)setClientRoleBroadcaster:(BOOL)isBroadcaster;
|
||
|
||
//禁麦 不发送本地录音
|
||
- (void)muteLocalAudioStream:(BOOL)mute;
|
||
|
||
/// 禁用音频
|
||
- (void)enableAudio:(BOOL)enble;
|
||
|
||
//切换耳机和扬声器
|
||
- (int)setEnableSpeakerphone:(BOOL)enableSpeaker;
|
||
|
||
//是否为扬声器
|
||
- (BOOL)isSpeakerphoneEnabled;
|
||
|
||
//屏蔽远端声音
|
||
- (int)muteAllRemoteAudioStreams:(BOOL)mute;
|
||
|
||
//设置混音效果
|
||
- (int)startAudioMixing:(NSString * _Nonnull)filePath
|
||
loopback:(BOOL)loopback
|
||
replace:(BOOL)replace
|
||
cycle:(NSInteger)cycle;
|
||
- (int)paseAudioMixing;
|
||
- (int)adjustAudioMixingVolume:(NSInteger)volume;
|
||
|
||
- (int)resumeAudioMixing;
|
||
|
||
- (double)getEffectsVolume;
|
||
|
||
- (int)stopAudioMixing;
|
||
|
||
|
||
- (void)RequestMusicURLData:(NSString *)MusicID;
|
||
|
||
/// 添加背景音乐
|
||
- (void)addBgMusic:(QXSongListModel *)music;
|
||
/// 下一首
|
||
- (void)nextBgMusic;
|
||
/// 暂停
|
||
- (void)pausePlayMusic;
|
||
/// 重新开始
|
||
- (void)resumePlayMusic;
|
||
|
||
|
||
|
||
/// 点歌房 //原唱0 伴奏1
|
||
-(void)ktv_OriginalSingSetting:(BOOL)isOriginal;
|
||
/// 销毁播放器
|
||
- (void)ktv_DestoryKtvPlayer;
|
||
/// 获取耳返状态
|
||
-(BOOL)ktv_GetErfan;
|
||
// 设置耳返
|
||
-(void)ktv_SetErfan:(BOOL)isErfan;
|
||
/// 开始播放
|
||
-(void)ktv_StartSing:(BOOL)isStart withSong:(QXSongListModel*)songModel;
|
||
/// 结束播放
|
||
-(void)ktv_EndSing;
|
||
/// 去加载歌词
|
||
-(void)ktv_LoadLrcWithSong:(QXSongListModel*)songModel;
|
||
/// 设置人声
|
||
-(void)ktv_SetRenshengVolume:(float)ratio;
|
||
/// 设置伴奏
|
||
-(void)ktv_SetBanzouVolume:(float)ratio;
|
||
/// 获取伴奏声音
|
||
-(float)ktv_GetBanzouVolume;
|
||
/// 搜索歌曲
|
||
-(void)searchSongWithKeyword:(NSString *)keywords page:(NSInteger)page resultBlock:(SearchSongBlock)resultBlock;
|
||
|
||
//设置原声
|
||
- (void)setLocalVoiceReverbOrginal;
|
||
|
||
//设置大叔
|
||
- (void)setLocationVoiceChangerIsOldMan;
|
||
|
||
//设置正太
|
||
- (void)setLocationVoiceChangerIsSmallMan;
|
||
//设置萝莉
|
||
- (void)setLocationVoiceChangerIsSmallGril;
|
||
|
||
//设置空灵
|
||
- (void)setLocationVoiceChangerIsEmptiness;
|
||
//设置演唱会
|
||
|
||
- (void)setLocalVoiceReverbSongSinger;
|
||
//设置KTV
|
||
- (void)setLocalVoiceReverbKTV;
|
||
//设置录音棚
|
||
- (void)setLocalVoiceReverbRecordingStudio;
|
||
/// 设置音色
|
||
- (int)ktv_setAudioEffectPreset:(AgoraAudioEffectPreset)prese;
|
||
/// 重置ktv声音及伴奏
|
||
- (void)ktv_resetVoice;
|
||
|
||
|
||
-(void)startScreenCapture;
|
||
|
||
-(void)startPreViewWithUid:(NSInteger)uid view:(UIView*)view;
|
||
@end
|
||
|
||
NS_ASSUME_NONNULL_END
|