Agora RTC Objective-C API Reference  Refactor
AgoraMusicContentCenter.h
Go to the documentation of this file.
1 //
2 // AgoraMusicContentCenter.h
3 // AgoraMusicContentCenter
4 //
5 // Created by dingyusong on 2022/6/1.
6 // Copyright © 2022 Agora. All rights reserved.
7 //
8 
9 #import <Foundation/Foundation.h>
10 #import "AgoraRtcEngineKit.h"
14 typedef NS_ENUM(NSUInteger, AgoraMusicContentCenterPreloadStatus) {
19 
24 
29 };
30 
34 typedef NS_ENUM(NSUInteger, AgoraMusicContentCenterStatusCode) {
39 
44 };
45 
46 NS_ASSUME_NONNULL_BEGIN
47 
48 __attribute__((visibility("default"))) @interface AgoraMusicChartInfo : NSObject
52 @property (nonatomic, copy) NSString *chartName;
56 @property (nonatomic, assign) NSInteger identify;
57 @end
58 
59 __attribute__((visibility("default"))) @interface AgoraMvProperty : NSObject
63 @property (nonatomic, copy) NSString *resolution;
67 @property (nonatomic, copy) NSString *bandwidth;
68 @end
69 
70 __attribute__((visibility("default"))) @interface AgoraClimaxSegment : NSObject
74 @property(nonatomic, assign) NSInteger startTimeMs;
78 @property(nonatomic, assign) NSInteger endTimeMs;
79 @end
80 
84 __attribute__((visibility("default"))) @interface AgoraMusic : NSObject
88 @property(nonatomic, assign) NSInteger songCode;
99 @property(nonatomic, assign) NSInteger type;
105 @property(nonatomic, assign) NSInteger pitchType;
109 @property(nonatomic, copy) NSString* name;
113 @property(nonatomic, copy) NSString* singer;
117 @property(nonatomic, copy) NSString* poster;
118 
122 @property(nonatomic, copy) NSString* releaseTime;
126 @property(nonatomic, assign) NSInteger durationS;
132 @property(nonatomic, strong) NSArray<NSNumber *>* lyricList;
136 @property(nonatomic, strong) NSArray<AgoraMvProperty *>* mvPropertyList;
140 @property(nonatomic, strong) NSArray<AgoraClimaxSegment *>* climaxSegmentList;
141 @end
142 
146 __attribute__((visibility("default"))) @interface AgoraMusicCollection : NSObject
150 @property(nonatomic, assign) NSInteger count;
154 @property(nonatomic, assign) NSInteger total;
158 @property(nonatomic, assign) NSInteger page;
162 @property(nonatomic, assign) NSInteger pageSize;
166 @property(nonatomic, strong) NSArray<AgoraMusic *>* musicList;
167 @end
168 
180 - (void)onMusicChartsResult:(NSString *)requestId status:(AgoraMusicContentCenterStatusCode)status result:(NSArray<AgoraMusicChartInfo*> *)result;
181 
189 - (void)onMusicCollectionResult:(NSString *)requestId status:(AgoraMusicContentCenterStatusCode)status result:(AgoraMusicCollection *)result;
190 
197 - (void)onLyricResult:(NSString*)requestId lyricUrl:(NSString*)lyricUrl;
198 
208 - (void)onPreLoadEvent:(NSInteger)songCode percent:(NSInteger)percent status:(AgoraMusicContentCenterPreloadStatus)status msg:(NSString *)msg lyricUrl:(NSString *)lyricUrl;
209 @end
210 
211 
212 @class AgoraRtcEngineKit;
213 __attribute__((visibility("default"))) @interface AgoraMusicContentCenterConfig : NSObject
214 @property(assign, nonatomic) AgoraRtcEngineKit* _Nullable rtcEngine;
218 @property (nonatomic, copy) NSString *appId;
222 @property (nonatomic, copy) NSString *token;
226 @property (nonatomic, assign) NSInteger mccUid;
227 @end
228 
239 - (NSInteger)openMediaWithSongCode:(NSInteger)songCode startPos:(NSInteger)startPos NS_SWIFT_NAME(openMedia(songCode:startPos:));
240 @end
241 
242 
243 __attribute__((visibility("default"))) @interface AgoraMusicContentCenter : NSObject
244 
251 + (instancetype)sharedContentCenterWithConfig:(AgoraMusicContentCenterConfig *)config NS_SWIFT_NAME(sharedContentCenter(config:));
252 
260 - (NSInteger)renewToken:(NSString * _Nonnull)token;
261 
271 - (NSInteger)registerEventDelegate:(id<AgoraMusicContentCenterEventDelegate> _Nullable)eventDelegate;
272 
281 - (id<AgoraMusicPlayerProtocol>)createMusicPlayerWithDelegate:(id<AgoraRtcMediaPlayerDelegate>_Nullable)delegate NS_SWIFT_NAME(createMusicPlayer(delegate:));
282 
288 - (NSString *)getMusicCharts;
289 
299 - (NSString *)getMusicCollectionWithMusicChartId:(NSInteger)musicChartId page:(NSInteger)page pageSize:(NSInteger)pageSize jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(getMusicCollection(musicChartId:page:pageSize:jsonOption:));
300 
310 - (NSString *)searchMusicWithKeyWord:(NSString *)keyWord page:(NSInteger)page pageSize:(NSInteger)pageSize jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(searchMusic(keyWord:page:pageSize:jsonOption:));
311 
321 - (NSInteger)preloadWithSongCode:(NSInteger)songCode jsonOption:(NSString* _Nullable)jsonOption NS_SWIFT_NAME(preload(songCode:jsonOption:));
322 
331 - (NSInteger)isPreloadedWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(isPreloaded(songCode:));
332 
340 - (NSString *)getLyricWithSongCode:(NSInteger)songCode lyricType:(NSInteger)lyricType NS_SWIFT_NAME(getLyric(songCode:lyricType:));
341 
347 - (void)enableMainQueueDispatch:(BOOL)enabled;
348 
354 + (void)destroy;
355 
356 @end
357 
358 NS_ASSUME_NONNULL_END
AgoraMusicContentCenterStatusCodeOK
@ AgoraMusicContentCenterStatusCodeOK
Definition: AgoraMusicContentCenter.h:38
AgoraRtcEngineKit
Definition: AgoraRtcEngineKit.h:1776
AgoraMusicContentCenterConfig
Definition: AgoraMusicContentCenter.h:214
AgoraMusicChartInfo
Definition: AgoraMusicContentCenter.h:49
+[AgoraMusicContentCenter destroy]
void destroy()
AgoraRtcMediaPlayerProtocol-p
Definition: AgoraRtcMediaPlayerProtocol.h:23
AgoraMusicContentCenter
Definition: AgoraMusicContentCenter.h:244
AgoraMusic
Definition: AgoraMusicContentCenter.h:85
AgoraMvProperty
Definition: AgoraMusicContentCenter.h:60
AgoraRtcMediaPlayerDelegate-p
Definition: AgoraRtcEngineKit.h:404
AgoraRtcEngineKit.h
AgoraMusicContentCenterStatusCode
AgoraMusicContentCenterStatusCode
Definition: AgoraMusicContentCenter.h:34
AgoraMusicContentCenterStatusCodeError
@ AgoraMusicContentCenterStatusCodeError
Definition: AgoraMusicContentCenter.h:43
AgoraMusicContentCenterPreloadStatusPreloading
@ AgoraMusicContentCenterPreloadStatusPreloading
Definition: AgoraMusicContentCenter.h:28
-[AgoraMusicContentCenter getMusicCharts]
NSString * getMusicCharts()
AgoraMusicCollection
Definition: AgoraMusicContentCenter.h:147
AgoraMusicContentCenterPreloadStatus
AgoraMusicContentCenterPreloadStatus
Definition: AgoraMusicContentCenter.h:14
AgoraClimaxSegment
Definition: AgoraMusicContentCenter.h:71
AgoraMusicContentCenterEventDelegate-p
Definition: AgoraMusicContentCenter.h:172
AgoraMusicChartInfo::identify
NSInteger identify
Definition: AgoraMusicContentCenter.h:56
AgoraMusicContentCenterPreloadStatusOK
@ AgoraMusicContentCenterPreloadStatusOK
Definition: AgoraMusicContentCenter.h:18
AgoraMusicChartInfo::chartName
NSString * chartName
Definition: AgoraMusicContentCenter.h:52
AgoraMusicPlayerProtocol-p
Definition: AgoraMusicContentCenter.h:229
AgoraMusicContentCenterPreloadStatusError
@ AgoraMusicContentCenterPreloadStatusError
Definition: AgoraMusicContentCenter.h:23