My Project
NECopyrightedMedia.h
Go to the documentation of this file.
1// Copyright (c) 2022 NetEase, Inc. All rights reserved.
2// Use of this source code is governed by a MIT license that can be
3// found in the LICENSE file.
4
5#import <Foundation/Foundation.h>
8
9NS_ASSUME_NONNULL_BEGIN
10
12@protocol NESongPreloadProtocol <NSObject>
13@optional
14
17- (void)onPreloadStart:(NSString *)songId channel:(SongChannel)channel;
18
22- (void)onPreloadProgress:(NSString *)songId channel:(SongChannel)channel progress:(float)progress;
23
27- (void)onPreloadComplete:(NSString *)songId
28 channel:(SongChannel)channel
29 error:(NSError *_Nullable)error;
30
31@end
32
34@protocol NECopyrightedEventHandler <NSObject>
35
37- (void)onTokenExpired;
38
39@optional
40
41@end
42
44@interface NECopyrightedMedia : NSObject
45
50+ (instancetype)getInstance;
51
58- (void)initialize:(NSString *_Nonnull)appkey
59 token:(NSString *_Nonnull)token
60 userUuid:(NSString *_Nullable)userUuid
61 extras:(NSDictionary *_Nullable)extras
62 callback:(void (^)(NSError *_Nullable error))callback;
63
71- (void)preloadSong:(NSString *)songId
72 channel:(SongChannel)channel
73 observe:(id<NESongPreloadProtocol> _Nullable)observe;
74
78- (void)clearSongCache;
79
83- (void)cancelPreloadSong:(NSString *)songId channel:(SongChannel)channel;
84
92- (bool)isSongPreloaded:(NSString *)songId channel:(SongChannel)channel;
93
100- (void)searchSong:(NSString *_Nullable)keyword
101 channel:(NSNumber *_Nullable)channel
102 pageNum:(NSNumber *_Nullable)pageNum
103 pageSize:(NSNumber *_Nullable)pageSize
104 callback:(void (^)(NSArray<NECopyrightedSong *> *_Nullable songList,
105 NSError *_Nullable error))callback;
106
115- (NSString *_Nullable)getSongURI:(NSString *_Nonnull)songId
116 channel:(SongChannel)channel
117 songResType:(SongResType)songResType;
118
125- (NSString *_Nullable)getLyric:(NSString *_Nonnull)songId channel:(SongChannel)channel;
126
133- (NSString *_Nullable)getPitch:(NSString *_Nonnull)songId channel:(SongChannel)channel;
134
138- (void)preloadSongLyric:(NSString *)songId
139 channel:(SongChannel)channel
140 callback:(void (^)(NSString *_Nullable content, NSString *_Nullable lyricType,
141 NSError *_Nullable error))callback;
150- (void)getSongList:(NSArray<NSString *> *_Nullable)tags
151 channel:(NSNumber *_Nullable)channel
152 pageNum:(NSNumber *_Nullable)pageNum
153 pageSize:(NSNumber *_Nullable)pageSize
154 callback:(void (^)(NSArray<NECopyrightedSong *> *songList, NSError *error))callback;
155
165- (void)getHotSongList:(NECopyrightedHotType)hotType
166 hotDimension:(NECopyrightedHotDimension)hotDimension
167 channel:(NSNumber *_Nullable)channel
168 pageNum:(NSNumber *_Nullable)pageNum
169 pageSize:(NSNumber *_Nullable)pageSize
170 callback:
171 (void (^)(NSArray<NECopyrightedHotSong *> *songList, NSError *error))callback;
174- (void)setEventHandler:(id<NECopyrightedEventHandler>)observe;
175
178- (void)renewToken:(NSString *)token;
179
184- (BOOL)hasInitialized;
185
188- (void)setSongScene:(SongScene)songScene;
189
190@end
191
192NS_ASSUME_NONNULL_END
SongResType
Definition: NECopyrightedMediaMacro.h:8
NECopyrightedHotDimension
点歌榜
Definition: NECopyrightedMediaMacro.h:74
NECopyrightedHotType
点歌榜单类型
Definition: NECopyrightedMediaMacro.h:66
SongScene
Definition: NECopyrightedMediaMacro.h:52
SongChannel
Definition: NECopyrightedMediaMacro.h:28
热门榜单Model
Definition: NECopyrightedHotSong.h:12
版权接口对象
Definition: NECopyrightedMedia.h:45
instancetype getInstance()
歌曲Model
Definition: NECopyrightedSong.h:12
动态Token监听
Definition: NECopyrightedMedia.h:34
void onTokenExpired()
Tokne过期
预加载协议
Definition: NECopyrightedMedia.h:12