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 
34 };
35 
39 typedef NS_ENUM(NSUInteger, AgoraMusicContentCenterStatusCode) {
76 
77 };
78 
79 typedef NS_ENUM(NSUInteger, AgoraMusicCacheStatusType) {
84 
89 };
90 
91 NS_ASSUME_NONNULL_BEGIN
92 
93 __attribute__((visibility("default"))) @interface AgoraMusicCacheInfo : NSObject
97 @property(nonatomic, assign) NSInteger songCode;
98 
102 @property(nonatomic, assign) AgoraMusicCacheStatusType statusType;
103 @end
104 
105 __attribute__((visibility("default"))) @interface AgoraMusicChartInfo : NSObject
109 @property (nonatomic, copy) NSString *chartName;
113 @property (nonatomic, assign) NSInteger identify;
114 @end
115 
116 __attribute__((visibility("default"))) @interface AgoraMvProperty : NSObject
120 @property (nonatomic, copy) NSString *resolution;
124 @property (nonatomic, copy) NSString *bandwidth;
125 @end
126 
127 __attribute__((visibility("default"))) @interface AgoraClimaxSegment : NSObject
131 @property(nonatomic, assign) NSInteger startTimeMs;
135 @property(nonatomic, assign) NSInteger endTimeMs;
136 @end
137 
141 __attribute__((visibility("default"))) @interface AgoraMusic : NSObject
145 @property(nonatomic, assign) NSInteger songCode;
156 @property(nonatomic, assign) NSInteger type;
162 @property(nonatomic, assign) NSInteger pitchType;
166 @property(nonatomic, copy) NSString* name;
170 @property(nonatomic, copy) NSString* singer;
174 @property(nonatomic, copy) NSString* poster;
175 
179 @property(nonatomic, copy) NSString* releaseTime;
183 @property(nonatomic, assign) NSInteger durationS;
189 @property(nonatomic, strong) NSArray<NSNumber *>* lyricList;
193 @property(nonatomic, strong) NSArray<AgoraMvProperty *>* mvPropertyList;
197 @property(nonatomic, strong) NSArray<AgoraClimaxSegment *>* climaxSegmentList;
198 @end
199 
203 __attribute__((visibility("default"))) @interface AgoraMusicCollection : NSObject
207 @property(nonatomic, assign) NSInteger count;
211 @property(nonatomic, assign) NSInteger total;
215 @property(nonatomic, assign) NSInteger page;
219 @property(nonatomic, assign) NSInteger pageSize;
223 @property(nonatomic, strong) NSArray<AgoraMusic *>* musicList;
224 @end
225 
237 - (void)onMusicChartsResult:(NSString *)requestId result:(NSArray<AgoraMusicChartInfo*> *)result errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
238 
246 - (void)onMusicCollectionResult:(NSString *)requestId result:(AgoraMusicCollection *)result errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
247 
256 - (void)onLyricResult:(NSString*)requestId songCode:(NSInteger)songCode lyricUrl:(NSString* _Nullable)lyricUrl errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
257 
266 - (void)onSongSimpleInfoResult:(NSString*)requestId songCode:(NSInteger)songCode simpleInfo:(NSString* _Nullable)simpleInfo errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
267 
278 - (void)onPreLoadEvent:(NSString*)requestId songCode:(NSInteger)songCode percent:(NSInteger)percent lyricUrl:(NSString * _Nullable)lyricUrl status:(AgoraMusicContentCenterPreloadStatus)status errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
279 @end
280 
281 
282 @class AgoraRtcEngineKit;
283 __attribute__((visibility("default"))) @interface AgoraMusicContentCenterConfig : NSObject
284 @property(assign, nonatomic) AgoraRtcEngineKit* _Nullable rtcEngine;
288 @property (nonatomic, copy) NSString *appId;
292 @property (nonatomic, copy) NSString *token;
296 @property (nonatomic, assign) NSInteger mccUid;
300 @property (nonatomic, assign) NSUInteger maxCacheSize;
301 @end
302 
313 - (NSInteger)openMediaWithSongCode:(NSInteger)songCode startPos:(NSInteger)startPos NS_SWIFT_NAME(openMedia(songCode:startPos:));
314 @end
315 
316 
317 __attribute__((visibility("default"))) @interface AgoraMusicContentCenter : NSObject
318 
325 + (instancetype _Nullable)sharedContentCenterWithConfig:(AgoraMusicContentCenterConfig *)config NS_SWIFT_NAME(sharedContentCenter(config:));
326 
334 - (NSInteger)renewToken:(NSString * _Nonnull)token;
335 
345 - (NSInteger)registerEventDelegate:(id<AgoraMusicContentCenterEventDelegate> _Nullable)eventDelegate;
346 
355 - (id<AgoraMusicPlayerProtocol> _Nullable)createMusicPlayerWithDelegate:(id<AgoraRtcMediaPlayerDelegate> _Nullable)delegate NS_SWIFT_NAME(createMusicPlayer(delegate:));
356 
362 - (NSString *)getMusicCharts;
363 
373 - (NSString *)getMusicCollectionWithMusicChartId:(NSInteger)musicChartId page:(NSInteger)page pageSize:(NSInteger)pageSize jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(getMusicCollection(musicChartId:page:pageSize:jsonOption:));
374 
384 - (NSString *)searchMusicWithKeyWord:(NSString *)keyWord page:(NSInteger)page pageSize:(NSInteger)pageSize jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(searchMusic(keyWord:page:pageSize:jsonOption:));
385 
396 - (NSInteger)preloadWithSongCode:(NSInteger)songCode jsonOption:(NSString* _Nullable)jsonOption NS_SWIFT_NAME(preload(songCode:jsonOption:)) __attribute__((deprecated("Use preload(songCode:) instead.")));
397 
404 - (NSString *)preloadWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(preload(songCode:));
405 
414 - (NSInteger)isPreloadedWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(isPreloaded(songCode:));
415 
424 - (NSInteger)removeCacheWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(removeCache(songCode:));
425 
431 - (NSArray *)getCaches NS_SWIFT_NAME(getCaches());
432 
442 - (NSInteger)getInternalSongCode:(NSInteger)songCode jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(getInternalSongCode(songCode:jsonOption:));
443 
451 - (NSString *)getLyricWithSongCode:(NSInteger)songCode lyricType:(NSInteger)lyricType NS_SWIFT_NAME(getLyric(songCode:lyricType:));
452 
459 - (NSString *)getSongSimpleInfoWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(getSongSimpleInfo(songCode:));
460 
466 - (void)enableMainQueueDispatch:(BOOL)enabled;
467 
473 + (void)destroy;
474 
475 @end
476 
477 NS_ASSUME_NONNULL_END
AgoraMusicContentCenterStatusCodeOK
@ AgoraMusicContentCenterStatusCodeOK
Definition: AgoraMusicContentCenter.h:43
AgoraRtcEngineKit
Definition: AgoraRtcEngineKit.h:1783
AgoraMusicCacheInfo::songCode
NSInteger songCode
Definition: AgoraMusicContentCenter.h:97
AgoraMusicCacheStatusTypeCaching
@ AgoraMusicCacheStatusTypeCaching
Definition: AgoraMusicContentCenter.h:88
AgoraMusicCacheStatusTypeCached
@ AgoraMusicCacheStatusTypeCached
Definition: AgoraMusicContentCenter.h:83
AgoraMusicContentCenterConfig
Definition: AgoraMusicContentCenter.h:284
AgoraMusicCacheInfo
Definition: AgoraMusicContentCenter.h:94
AgoraMusicChartInfo
Definition: AgoraMusicContentCenter.h:106
-[AgoraMusicContentCenter getCaches]
NSArray * getCaches()
+[AgoraMusicContentCenter destroy]
void destroy()
AgoraMusicContentCenterStatusCodeErrorPermissionAndResource
@ AgoraMusicContentCenterStatusCodeErrorPermissionAndResource
Definition: AgoraMusicContentCenter.h:63
AgoraRtcMediaPlayerProtocol-p
Definition: AgoraRtcMediaPlayerProtocol.h:23
AgoraMusicContentCenter
Definition: AgoraMusicContentCenter.h:318
AgoraMusic
Definition: AgoraMusicContentCenter.h:142
AgoraMvProperty
Definition: AgoraMusicContentCenter.h:117
AgoraRtcMediaPlayerDelegate-p
Definition: AgoraRtcEngineKit.h:394
AgoraMusicCacheInfo::statusType
AgoraMusicCacheStatusType statusType
Definition: AgoraMusicContentCenter.h:102
AgoraRtcEngineKit.h
AgoraMusicContentCenterStatusCode
AgoraMusicContentCenterStatusCode
Definition: AgoraMusicContentCenter.h:39
AgoraMusicContentCenterStatusCodeError
@ AgoraMusicContentCenterStatusCodeError
Definition: AgoraMusicContentCenter.h:50
AgoraMusicContentCenterStatusCodeErrorMusicLoading
@ AgoraMusicContentCenterStatusCodeErrorMusicLoading
Definition: AgoraMusicContentCenter.h:71
AgoraMusicContentCenterPreloadStatusPreloading
@ AgoraMusicContentCenterPreloadStatusPreloading
Definition: AgoraMusicContentCenter.h:28
-[AgoraMusicContentCenter getMusicCharts]
NSString * getMusicCharts()
AgoraMusicContentCenterStatusCodeErrorGateway
@ AgoraMusicContentCenterStatusCodeErrorGateway
Definition: AgoraMusicContentCenter.h:57
AgoraMusicCollection
Definition: AgoraMusicContentCenter.h:204
AgoraMusicContentCenterPreloadStatus
AgoraMusicContentCenterPreloadStatus
Definition: AgoraMusicContentCenter.h:14
AgoraClimaxSegment
Definition: AgoraMusicContentCenter.h:128
AgoraMusicContentCenterStatusCodeErrorInternalDataParse
@ AgoraMusicContentCenterStatusCodeErrorInternalDataParse
Definition: AgoraMusicContentCenter.h:67
AgoraMusicContentCenterEventDelegate-p
Definition: AgoraMusicContentCenter.h:229
AgoraMusicContentCenterPreloadStatusOK
@ AgoraMusicContentCenterPreloadStatusOK
Definition: AgoraMusicContentCenter.h:18
AgoraMusicPlayerProtocol-p
Definition: AgoraMusicContentCenter.h:303
AgoraMusicContentCenterStatusCodeErrorMusicDecryption
@ AgoraMusicContentCenterStatusCodeErrorMusicDecryption
Definition: AgoraMusicContentCenter.h:75
AgoraMusicCacheStatusType
AgoraMusicCacheStatusType
Definition: AgoraMusicContentCenter.h:79
AgoraMusicContentCenterPreloadStatusError
@ AgoraMusicContentCenterPreloadStatusError
Definition: AgoraMusicContentCenter.h:23
AgoraMusicContentCenterPreloadStatusRemoveCache
@ AgoraMusicContentCenterPreloadStatusRemoveCache
Definition: AgoraMusicContentCenter.h:33