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"
11
12
13
17 typedef NS_ENUM(NSUInteger, AgoraMusicPlayMode) {
21 AgoraMusicPlayModeOriginal = 0,
22
26 AgoraMusicPlayModeAccompany = 1,
30 AgoraMusicPlayModeLeadsing = 2,
31 };
32
36 typedef NS_ENUM(NSUInteger, AgoraMusicContentCenterPreloadStatus) {
40 AgoraMusicContentCenterPreloadStatusOK = 0,
41
45 AgoraMusicContentCenterPreloadStatusError = 1,
46
50 AgoraMusicContentCenterPreloadStatusPreloading = 2,
51
55 AgoraMusicContentCenterPreloadStatusRemoveCache = 3,
56 };
57
61 typedef NS_ENUM(NSUInteger, AgoraMusicContentCenterStatusCode) {
65 AgoraMusicContentCenterStatusCodeOK = 0,
72 AgoraMusicContentCenterStatusCodeError = 1,
79 AgoraMusicContentCenterStatusCodeErrorGateway = 2,
85 AgoraMusicContentCenterStatusCodeErrorPermissionAndResource = 3,
89 AgoraMusicContentCenterStatusCodeErrorInternalDataParse = 4,
93 AgoraMusicContentCenterStatusCodeErrorMusicLoading = 5,
97 AgoraMusicContentCenterStatusCodeErrorMusicDecryption = 6,
101 AgoraMusicContentCenterStatusCodeErrorHttpInternalError = 7,
102 };
103
104 typedef NS_ENUM(NSUInteger, AgoraMusicCacheStatusType) {
108 AgoraMusicCacheStatusTypeCached = 0,
109
113 AgoraMusicCacheStatusTypeCaching = 1,
114 };
115
116 NS_ASSUME_NONNULL_BEGIN
117
118 __attribute__((visibility("default"))) @interface AgoraMusicCacheInfo : NSObject
122 @property(nonatomic, assign) NSInteger songCode;
123
127 @property(nonatomic, assign) AgoraMusicCacheStatusType statusType;
128 @end
129
130 __attribute__((visibility("default"))) @interface AgoraMusicChartInfo : NSObject
134 @property (nonatomic, copy) NSString *chartName;
138 @property (nonatomic, assign) NSInteger identify;
139 @end
140
141 __attribute__((visibility("default"))) @interface AgoraMvProperty : NSObject
145 @property (nonatomic, copy) NSString *resolution;
149 @property (nonatomic, copy) NSString *bandwidth;
150 @end
151
152 __attribute__((visibility("default"))) @interface AgoraClimaxSegment : NSObject
156 @property(nonatomic, assign) NSInteger startTimeMs;
160 @property(nonatomic, assign) NSInteger endTimeMs;
161 @end
162
166 __attribute__((visibility("default"))) @interface AgoraMusic : NSObject
170 @property(nonatomic, assign) NSInteger songCode;
181 @property(nonatomic, assign) NSInteger type;
187 @property(nonatomic, assign) NSInteger pitchType;
191 @property(nonatomic, copy) NSString* name;
195 @property(nonatomic, copy) NSString* singer;
199 @property(nonatomic, copy) NSString* poster;
200
204 @property(nonatomic, copy) NSString* releaseTime;
208 @property(nonatomic, assign) NSInteger durationS;
214 @property(nonatomic, strong) NSArray<NSNumber *>* lyricList;
218 @property(nonatomic, strong) NSArray<AgoraMvProperty *>* mvPropertyList;
222 @property(nonatomic, strong) NSArray<AgoraClimaxSegment *>* climaxSegmentList;
223 @end
224
228 __attribute__((visibility("default"))) @interface AgoraMusicCollection : NSObject
232 @property(nonatomic, assign) NSInteger count;
236 @property(nonatomic, assign) NSInteger total;
240 @property(nonatomic, assign) NSInteger page;
244 @property(nonatomic, assign) NSInteger pageSize;
248 @property(nonatomic, strong) NSArray<AgoraMusic *>* musicList;
249 @end
250
254 @protocol AgoraMusicContentCenterEventDelegate <NSObject>
262 - (void)onMusicChartsResult:(NSString *)requestId result:(NSArray<AgoraMusicChartInfo*> *)result errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
263
271 - (void)onMusicCollectionResult:(NSString *)requestId result:(AgoraMusicCollection *)result errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
272
281 - (void)onLyricResult:(NSString*)requestId songCode:(NSInteger)songCode lyricUrl:(NSString* _Nullable)lyricUrl errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
282
291 - (void)onSongSimpleInfoResult:(NSString*)requestId songCode:(NSInteger)songCode simpleInfo:(NSString* _Nullable)simpleInfo errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
292
303 - (void)onPreLoadEvent:(NSString*)requestId songCode:(NSInteger)songCode percent:(NSInteger)percent lyricUrl:(NSString * _Nullable)lyricUrl status:(AgoraMusicContentCenterPreloadStatus)status errorCode:(AgoraMusicContentCenterStatusCode)errorCode;
304 @end
305
306
307 @class AgoraRtcEngineKit;
308 __attribute__((visibility("default"))) @interface AgoraMusicContentCenterConfig : NSObject
309 @property(assign, nonatomic) AgoraRtcEngineKit* _Nullable rtcEngine;
313 @property (nonatomic, copy) NSString *appId;
317 @property (nonatomic, copy) NSString *token;
321 @property (nonatomic, assign) NSInteger mccUid;
325 @property (nonatomic, assign) NSUInteger maxCacheSize;
329 @property(nonatomic, copy) NSString* mccDomain;
333 @property(nonatomic, weak) id<AgoraMusicContentCenterEventDelegate> eventDelegate;
334 @end
335
336 @protocol AgoraMusicPlayerProtocol <AgoraRtcMediaPlayerProtocol>
346 - (NSInteger)openMediaWithSongCode:(NSInteger)songCode startPos:(NSInteger)startPos NS_SWIFT_NAME(openMedia(songCode:startPos:));
347
356 - (NSInteger)setPlayMode:(AgoraMusicPlayMode)mode NS_SWIFT_NAME(setPlayMode(mode:));
357
358 @end
359
360
361 __attribute__((visibility("default"))) @interface AgoraMusicContentCenter : NSObject
362
369 + (instancetype _Nullable)sharedContentCenterWithConfig:(AgoraMusicContentCenterConfig *)config NS_SWIFT_NAME(sharedContentCenter(config:));
370
378 - (NSInteger)renewToken:(NSString * _Nonnull)token;
379
389 - (NSInteger)registerEventDelegate:(id<AgoraMusicContentCenterEventDelegate> _Nullable)eventDelegate;
390
399 - (id<AgoraMusicPlayerProtocol> _Nullable)createMusicPlayerWithDelegate:(id<AgoraRtcMediaPlayerDelegate> _Nullable)delegate NS_SWIFT_NAME(createMusicPlayer(delegate:));
400
409 - (NSInteger)destroyMusicPlayer:(id<AgoraMusicPlayerProtocol>)musicPlayer;
410
416 - (NSString *)getMusicCharts;
417
427 - (NSString *)getMusicCollectionWithMusicChartId:(NSInteger)musicChartId page:(NSInteger)page pageSize:(NSInteger)pageSize jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(getMusicCollection(musicChartId:page:pageSize:jsonOption:));
428
438 - (NSString *)searchMusicWithKeyWord:(NSString *)keyWord page:(NSInteger)page pageSize:(NSInteger)pageSize jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(searchMusic(keyWord:page:pageSize:jsonOption:));
439
450 - (NSInteger)preloadWithSongCode:(NSInteger)songCode jsonOption:(NSString* _Nullable)jsonOption NS_SWIFT_NAME(preload(songCode:jsonOption:)) __attribute__((deprecated("Use preload(songCode:) instead.")));
451
458 - (NSString *)preloadWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(preload(songCode:));
459
468 - (NSInteger)isPreloadedWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(isPreloaded(songCode:));
469
478 - (NSInteger)removeCacheWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(removeCache(songCode:));
479
485 - (NSArray *)getCaches NS_SWIFT_NAME(getCaches());
486
496 - (NSInteger)getInternalSongCode:(NSInteger)songCode jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(getInternalSongCode(songCode:jsonOption:));
497
505 - (NSString *)getLyricWithSongCode:(NSInteger)songCode lyricType:(NSInteger)lyricType NS_SWIFT_NAME(getLyric(songCode:lyricType:));
506
513 - (NSString *)getSongSimpleInfoWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(getSongSimpleInfo(songCode:));
514
520 - (void)enableMainQueueDispatch:(BOOL)enabled;
521
527 + (void)destroy;
528
529 @end
530
531 NS_ASSUME_NONNULL_END
AgoraMusicContentCenterStatusCodeOK
@ AgoraMusicContentCenterStatusCodeOK
Definition: AgoraMusicContentCenter.h:65
AgoraRtcEngineKit
Definition: AgoraRtcEngineKit.h:1813
AgoraMusicCacheInfo::songCode
NSInteger songCode
Definition: AgoraMusicContentCenter.h:122
AgoraMusicCacheStatusTypeCaching
@ AgoraMusicCacheStatusTypeCaching
Definition: AgoraMusicContentCenter.h:113
AgoraMusicCacheStatusTypeCached
@ AgoraMusicCacheStatusTypeCached
Definition: AgoraMusicContentCenter.h:108
AgoraMusicContentCenterConfig
Definition: AgoraMusicContentCenter.h:309
AgoraMusicCacheInfo
Definition: AgoraMusicContentCenter.h:119
AgoraMusicChartInfo
Definition: AgoraMusicContentCenter.h:131
-[AgoraMusicContentCenter getCaches]
NSArray * getCaches()
+[AgoraMusicContentCenter destroy]
void destroy()
AgoraMusicPlayModeOriginal
@ AgoraMusicPlayModeOriginal
Definition: AgoraMusicContentCenter.h:21
AgoraMusicContentCenterStatusCodeErrorPermissionAndResource
@ AgoraMusicContentCenterStatusCodeErrorPermissionAndResource
Definition: AgoraMusicContentCenter.h:85
AgoraRtcMediaPlayerProtocol-p
Definition: AgoraRtcMediaPlayerProtocol.h:23
AgoraMusicContentCenter
Definition: AgoraMusicContentCenter.h:362
AgoraMusic
Definition: AgoraMusicContentCenter.h:167
AgoraMvProperty
Definition: AgoraMusicContentCenter.h:142
AgoraMusicPlayModeAccompany
@ AgoraMusicPlayModeAccompany
Definition: AgoraMusicContentCenter.h:26
AgoraRtcMediaPlayerDelegate-p
Definition: AgoraRtcEngineKit.h:411
AgoraMusicCacheInfo::statusType
AgoraMusicCacheStatusType statusType
Definition: AgoraMusicContentCenter.h:127
AgoraRtcEngineKit.h
AgoraMusicContentCenterStatusCode
AgoraMusicContentCenterStatusCode
Definition: AgoraMusicContentCenter.h:61
AgoraMusicContentCenterStatusCodeError
@ AgoraMusicContentCenterStatusCodeError
Definition: AgoraMusicContentCenter.h:72
AgoraMusicContentCenterStatusCodeErrorMusicLoading
@ AgoraMusicContentCenterStatusCodeErrorMusicLoading
Definition: AgoraMusicContentCenter.h:93
AgoraMusicContentCenterPreloadStatusPreloading
@ AgoraMusicContentCenterPreloadStatusPreloading
Definition: AgoraMusicContentCenter.h:50
-[AgoraMusicContentCenter getMusicCharts]
NSString * getMusicCharts()
AgoraMusicContentCenterStatusCodeErrorGateway
@ AgoraMusicContentCenterStatusCodeErrorGateway
Definition: AgoraMusicContentCenter.h:79
AgoraMusicCollection
Definition: AgoraMusicContentCenter.h:229
AgoraMusicContentCenterPreloadStatus
AgoraMusicContentCenterPreloadStatus
Definition: AgoraMusicContentCenter.h:36
AgoraClimaxSegment
Definition: AgoraMusicContentCenter.h:153
AgoraMusicContentCenterStatusCodeErrorInternalDataParse
@ AgoraMusicContentCenterStatusCodeErrorInternalDataParse
Definition: AgoraMusicContentCenter.h:89
AgoraMusicContentCenterEventDelegate-p
Definition: AgoraMusicContentCenter.h:254
AgoraMusicContentCenterStatusCodeErrorHttpInternalError
@ AgoraMusicContentCenterStatusCodeErrorHttpInternalError
Definition: AgoraMusicContentCenter.h:101
AgoraMusicPlayModeLeadsing
@ AgoraMusicPlayModeLeadsing
Definition: AgoraMusicContentCenter.h:30
AgoraMusicContentCenterPreloadStatusOK
@ AgoraMusicContentCenterPreloadStatusOK
Definition: AgoraMusicContentCenter.h:40
AgoraMusicPlayMode
AgoraMusicPlayMode
Definition: AgoraMusicContentCenter.h:17
AgoraMusicPlayerProtocol-p
Definition: AgoraMusicContentCenter.h:336
AgoraMusicContentCenterStatusCodeErrorMusicDecryption
@ AgoraMusicContentCenterStatusCodeErrorMusicDecryption
Definition: AgoraMusicContentCenter.h:97
AgoraMusicCacheStatusType
AgoraMusicCacheStatusType
Definition: AgoraMusicContentCenter.h:104
AgoraMusicContentCenterPreloadStatusError
@ AgoraMusicContentCenterPreloadStatusError
Definition: AgoraMusicContentCenter.h:45
AgoraMusicContentCenterPreloadStatusRemoveCache
@ AgoraMusicContentCenterPreloadStatusRemoveCache
Definition: AgoraMusicContentCenter.h:55