@@ -17,10 +17,15 @@ import AgoraRtcKit
17
17
// case followSinger //跟唱
18
18
}
19
19
20
+ @objc public enum loadMusicType : Int {
21
+ case mcc
22
+ case local
23
+ }
20
24
21
25
/// 歌曲状态
22
26
@objc public enum KTVPlayerTrackMode : Int {
23
27
case origin = 0 //原唱
28
+ case lead //导唱
24
29
case acc //伴奏
25
30
}
26
31
@@ -131,18 +136,15 @@ import AgoraRtcKit
131
136
/// 歌曲得分回调
132
137
/// - Parameter score: <#score description#>
133
138
func onSingingScoreResult( score: Float )
134
-
135
-
139
+
136
140
/// 角色切换回调
137
141
/// - Parameters:
138
142
/// - oldRole: <#oldRole description#>
139
143
/// - newRole: <#newRole description#>
140
144
func onSingerRoleChanged( oldRole: KTVSingRole , newRole: KTVSingRole )
141
145
146
+ func onTokenPrivilegeWillExpire( )
142
147
143
-
144
- func onTokenPrivilegeWillExpire( )
145
-
146
148
/**
147
149
* 合唱频道人声音量提示
148
150
* @param speakers 不同用户音量信息
@@ -163,6 +165,8 @@ import AgoraRtcKit
163
165
var chorusChannelToken : String
164
166
var type : KTVType = . normal
165
167
var maxCacheSize : Int = 10
168
+ var musicType : loadMusicType = . mcc
169
+ var isDebugMode : Bool = false
166
170
@objc public
167
171
init ( appId: String ,
168
172
rtmToken: String ,
@@ -172,7 +176,9 @@ import AgoraRtcKit
172
176
chorusChannelName: String ,
173
177
chorusChannelToken: String ,
174
178
type: KTVType ,
175
- maxCacheSize: Int
179
+ maxCacheSize: Int ,
180
+ musicType: loadMusicType ,
181
+ isDebugMode: Bool
176
182
) {
177
183
self . appId = appId
178
184
self . rtmToken = rtmToken
@@ -183,6 +189,8 @@ import AgoraRtcKit
183
189
self . chorusChannelToken = chorusChannelToken
184
190
self . type = type
185
191
self . maxCacheSize = maxCacheSize
192
+ self . musicType = musicType
193
+ self . isDebugMode = isDebugMode
186
194
}
187
195
}
188
196
@@ -192,6 +200,23 @@ import AgoraRtcKit
192
200
public var autoPlay : Bool = false //是否加载完成自动播放
193
201
public var mainSingerUid : Int = 0 //主唱uid
194
202
public var mode : KTVLoadMusicMode = . loadMusicAndLrc
203
+
204
+ func printObjectContent( ) -> String {
205
+ var content = " "
206
+
207
+ let mirror = Mirror ( reflecting: self )
208
+ for child in mirror. children {
209
+ if let propertyName = child. label {
210
+ if let propertyValue = child. value as? CustomStringConvertible {
211
+ content += " \( propertyName) : \( propertyValue) \n "
212
+ } else {
213
+ content += " \( propertyName) : \( child. value) \n "
214
+ }
215
+ }
216
+ }
217
+
218
+ return content
219
+ }
195
220
}
196
221
197
222
@@ -331,16 +356,47 @@ public typealias JoinExChannelCallBack = ((Bool, KTVJoinChorusFailReason?)-> Voi
331
356
/// - Parameter isOnMicOpen: <#isOnMicOpen description#>
332
357
func setMicStatus( isOnMicOpen: Bool )
333
358
334
- /// 获取mpk实例
335
- /// - Returns: <#description#>
336
- func getMediaPlayer( ) -> AgoraMusicPlayerProtocol ?
359
+ func getMusicPlayer( ) -> AgoraRtcMediaPlayerProtocol ?
337
360
338
361
/// 获取MCC实例
339
362
/// - Returns: <#description#>
340
363
func getMusicContentCenter( ) -> AgoraMusicContentCenter ?
341
364
365
+ // 开启专业主播模式
366
+ func enableProfessionalStreamerMode( _ enable: Bool )
367
+
342
368
/**
343
369
创建dataStreamID
344
370
*/
345
371
func renewInnerDataStreamId( )
372
+
373
+
374
+ /**
375
+ * 加载歌曲,同时只能为一首歌loadSong,同步调用, 一般使用此loadSong是歌曲已经preload成功(url为本地文件地址)
376
+ * @param config 加载歌曲配置,config.autoPlay = true,默认播放url1
377
+ * @param url1 歌曲地址1
378
+ * @param url2 歌曲地址2
379
+ *
380
+ *
381
+ * 推荐调用:
382
+ * 歌曲开始时:
383
+ * 主唱 loadMusic(KTVSongConfiguration(autoPlay=true, mode=LOAD_MUSIC_AND_LRC, url, mainSingerUid)) switchSingerRole(SoloSinger)
384
+ * 观众 loadMusic(KTVSongConfiguration(autoPlay=false, mode=LOAD_LRC_ONLY, url, mainSingerUid))
385
+ * 加入合唱时:
386
+ * 准备加入合唱者:loadMusic(KTVSongConfiguration(autoPlay=false, mode=LOAD_MUSIC_ONLY, url, mainSingerUid))
387
+ * loadMusic成功后switchSingerRole(CoSinger)
388
+ */
389
+ func load2Music(
390
+ url1: String ,
391
+ url2: String ,
392
+ config: KTVSongConfiguration
393
+ )
394
+
395
+ /**
396
+ * 多文件切换播放资源
397
+ * @param url 需要切换的播放资源,需要为 load2Music 中 参数 url1,url2 中的一个
398
+ * @param syncPts 是否同步切换前后的起始播放位置: true 同步,false 不同步,从 0 开始
399
+ */
400
+ func switchPlaySrc( url: String , syncPts: Bool )
401
+
346
402
}
0 commit comments