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) {
80 };
81 
82 typedef NS_ENUM(NSUInteger, AgoraMusicCacheStatusType) {
87 
92 };
93 
94 NS_ASSUME_NONNULL_BEGIN
95 
96 __attribute__((visibility("default"))) @interface AgoraMusicCacheInfo : NSObject
100 @property(nonatomic, assign) NSInteger songCode;
101 
105 @property(nonatomic, assign) AgoraMusicCacheStatusType statusType;
106 @end
107 
108 __attribute__((visibility("default"))) @interface AgoraMusicChartInfo : NSObject
112 @property (nonatomic, copy) NSString *chartName;
116 @property (nonatomic, assign) NSInteger identify;
117 @end
118 
119 __attribute__((visibility("default"))) @interface AgoraMvProperty : NSObject
123 @property (nonatomic, copy) NSString *resolution;
127 @property (nonatomic, copy) NSString *bandwidth;
128 @end
129 
130 __attribute__((visibility("default"))) @interface AgoraClimaxSegment : NSObject
134 @property(nonatomic, assign) NSInteger startTimeMs;
138 @property(nonatomic, assign) NSInteger endTimeMs;
139 @end
140 
144 __attribute__((visibility("default"))) @interface AgoraMusic : NSObject
148 @property(nonatomic, assign) NSInteger songCode;
159 @property(nonatomic, assign) NSInteger type;
165 @property(nonatomic, assign) NSInteger pitchType;
169 @property(nonatomic, copy) NSString* name;
173 @property(nonatomic, copy) NSString* singer;
177 @property(nonatomic, copy) NSString* poster;
178 
182 @property(nonatomic, copy) NSString* releaseTime;
186 @property(nonatomic, assign) NSInteger durationS;
192 @property(nonatomic, strong) NSArray<NSNumber *>* lyricList;
196 @property(nonatomic, strong) NSArray<AgoraMvProperty *>* mvPropertyList;
200 @property(nonatomic, strong) NSArray<AgoraClimaxSegment *>* climaxSegmentList;
201 @end
202 
206 __attribute__((visibility("default"))) @interface AgoraMusicCollection : NSObject
210 @property(nonatomic, assign) NSInteger count;
214 @property(nonatomic, assign) NSInteger total;
218 @property(nonatomic, assign) NSInteger page;
222 @property(nonatomic, assign) NSInteger pageSize;
226 @property(nonatomic, strong) NSArray<AgoraMusic *>* musicList;
227 @end
228 
240 - (void)onMusicChartsResult:(NSString *)requestId result:(NSArray<AgoraMusicChartInfo*> *)result errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
241 
249 - (void)onMusicCollectionResult:(NSString *)requestId result:(AgoraMusicCollection *)result errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
250 
259 - (void)onLyricResult:(NSString*)requestId songCode:(NSInteger)songCode lyricUrl:(NSString* _Nullable)lyricUrl errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
260 
269 - (void)onSongSimpleInfoResult:(NSString*)requestId songCode:(NSInteger)songCode simpleInfo:(NSString* _Nullable)simpleInfo errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
270 
281 - (void)onPreLoadEvent:(NSString*)requestId songCode:(NSInteger)songCode percent:(NSInteger)percent lyricUrl:(NSString * _Nullable)lyricUrl status:(AgoraMusicContentCenterPreloadStatus)status errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
282 @end
283 
284 
285 @class AgoraRtcEngineKit;
286 __attribute__((visibility("default"))) @interface AgoraMusicContentCenterConfig : NSObject
287 @property(assign, nonatomic) AgoraRtcEngineKit* _Nullable rtcEngine;
291 @property (nonatomic, copy) NSString *appId;
295 @property (nonatomic, copy) NSString *token;
299 @property (nonatomic, assign) NSInteger mccUid;
303 @property (nonatomic, assign) NSUInteger maxCacheSize;
307 @property(nonatomic, copy) NSString* mccDomain;
308 @end
309 
320 - (NSInteger)openMediaWithSongCode:(NSInteger)songCode startPos:(NSInteger)startPos NS_SWIFT_NAME(openMedia(songCode:startPos:));
321 @end
322 
323 
324 __attribute__((visibility("default"))) @interface AgoraMusicContentCenter : NSObject
325 
332 + (instancetype _Nullable)sharedContentCenterWithConfig:(AgoraMusicContentCenterConfig *)config NS_SWIFT_NAME(sharedContentCenter(config:));
333 
341 - (NSInteger)renewToken:(NSString * _Nonnull)token;
342 
352 - (NSInteger)registerEventDelegate:(id<AgoraMusicContentCenterEventDelegate> _Nullable)eventDelegate;
353 
362 - (id<AgoraMusicPlayerProtocol> _Nullable)createMusicPlayerWithDelegate:(id<AgoraRtcMediaPlayerDelegate> _Nullable)delegate NS_SWIFT_NAME(createMusicPlayer(delegate:));
363 
369 - (NSString *)getMusicCharts;
370 
380 - (NSString *)getMusicCollectionWithMusicChartId:(NSInteger)musicChartId page:(NSInteger)page pageSize:(NSInteger)pageSize jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(getMusicCollection(musicChartId:page:pageSize:jsonOption:));
381 
391 - (NSString *)searchMusicWithKeyWord:(NSString *)keyWord page:(NSInteger)page pageSize:(NSInteger)pageSize jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(searchMusic(keyWord:page:pageSize:jsonOption:));
392 
403 - (NSInteger)preloadWithSongCode:(NSInteger)songCode jsonOption:(NSString* _Nullable)jsonOption NS_SWIFT_NAME(preload(songCode:jsonOption:)) __attribute__((deprecated("Use preload(songCode:) instead.")));
404 
411 - (NSString *)preloadWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(preload(songCode:));
412 
421 - (NSInteger)isPreloadedWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(isPreloaded(songCode:));
422 
431 - (NSInteger)removeCacheWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(removeCache(songCode:));
432 
438 - (NSArray *)getCaches NS_SWIFT_NAME(getCaches());
439 
449 - (NSInteger)getInternalSongCode:(NSInteger)songCode jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(getInternalSongCode(songCode:jsonOption:));
450 
458 - (NSString *)getLyricWithSongCode:(NSInteger)songCode lyricType:(NSInteger)lyricType NS_SWIFT_NAME(getLyric(songCode:lyricType:));
459 
466 - (NSString *)getSongSimpleInfoWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(getSongSimpleInfo(songCode:));
467 
473 - (void)enableMainQueueDispatch:(BOOL)enabled;
474 
480 + (void)destroy;
481 
482 @end
483 
484 NS_ASSUME_NONNULL_END
AgoraMusicContentCenterStatusCodeOK
@ AgoraMusicContentCenterStatusCodeOK
Definition: AgoraMusicContentCenter.h:43
AgoraRtcEngineKit
Definition: AgoraRtcEngineKit.h:1796
AgoraMusicCacheInfo::songCode
NSInteger songCode
Definition: AgoraMusicContentCenter.h:100
AgoraMusicCacheStatusTypeCaching
@ AgoraMusicCacheStatusTypeCaching
Definition: AgoraMusicContentCenter.h:91
AgoraMusicCacheStatusTypeCached
@ AgoraMusicCacheStatusTypeCached
Definition: AgoraMusicContentCenter.h:86
AgoraMusicContentCenterConfig
Definition: AgoraMusicContentCenter.h:287
AgoraMusicCacheInfo
Definition: AgoraMusicContentCenter.h:97
AgoraMusicChartInfo
Definition: AgoraMusicContentCenter.h:109
-[AgoraMusicContentCenter getCaches]
NSArray * getCaches()
+[AgoraMusicContentCenter destroy]
void destroy()
AgoraMusicContentCenterStatusCodeErrorPermissionAndResource
@ AgoraMusicContentCenterStatusCodeErrorPermissionAndResource
Definition: AgoraMusicContentCenter.h:63
AgoraRtcMediaPlayerProtocol-p
Definition: AgoraRtcMediaPlayerProtocol.h:23
AgoraMusicContentCenter
Definition: AgoraMusicContentCenter.h:325
AgoraMusic
Definition: AgoraMusicContentCenter.h:145
AgoraMvProperty
Definition: AgoraMusicContentCenter.h:120
AgoraRtcMediaPlayerDelegate-p
Definition: AgoraRtcEngineKit.h:394
AgoraMusicCacheInfo::statusType
AgoraMusicCacheStatusType statusType
Definition: AgoraMusicContentCenter.h:105
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:207
AgoraMusicContentCenterPreloadStatus
AgoraMusicContentCenterPreloadStatus
Definition: AgoraMusicContentCenter.h:14
AgoraClimaxSegment
Definition: AgoraMusicContentCenter.h:131
AgoraMusicContentCenterStatusCodeErrorInternalDataParse
@ AgoraMusicContentCenterStatusCodeErrorInternalDataParse
Definition: AgoraMusicContentCenter.h:67
AgoraMusicContentCenterEventDelegate-p
Definition: AgoraMusicContentCenter.h:232
AgoraMusicContentCenterStatusCodeErrorHttpInternalError
@ AgoraMusicContentCenterStatusCodeErrorHttpInternalError
Definition: AgoraMusicContentCenter.h:79
AgoraMusicContentCenterPreloadStatusOK
@ AgoraMusicContentCenterPreloadStatusOK
Definition: AgoraMusicContentCenter.h:18
AgoraMusicPlayerProtocol-p
Definition: AgoraMusicContentCenter.h:310
AgoraMusicContentCenterStatusCodeErrorMusicDecryption
@ AgoraMusicContentCenterStatusCodeErrorMusicDecryption
Definition: AgoraMusicContentCenter.h:75
AgoraMusicCacheStatusType
AgoraMusicCacheStatusType
Definition: AgoraMusicContentCenter.h:82
AgoraMusicContentCenterPreloadStatusError
@ AgoraMusicContentCenterPreloadStatusError
Definition: AgoraMusicContentCenter.h:23
AgoraMusicContentCenterPreloadStatusRemoveCache
@ AgoraMusicContentCenterPreloadStatusRemoveCache
Definition: AgoraMusicContentCenter.h:33