Skip to content

Commit 3869cfc

Browse files
authored
Release/3.3.0 ios (#8)
v3.3.0 iOS
1 parent 4827a02 commit 3869cfc

File tree

13 files changed

+1925
-350
lines changed

13 files changed

+1925
-350
lines changed
File renamed without changes.

KTVAPI/iOS/Classes/KTVApi.swift

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@ import AgoraRtcKit
1717
// case followSinger //跟唱
1818
}
1919

20+
@objc public enum loadMusicType: Int {
21+
case mcc
22+
case local
23+
}
2024

2125
/// 歌曲状态
2226
@objc public enum KTVPlayerTrackMode: Int {
2327
case origin = 0 //原唱
28+
case lead //导唱
2429
case acc //伴奏
2530
}
2631

@@ -131,18 +136,15 @@ import AgoraRtcKit
131136
/// 歌曲得分回调
132137
/// - Parameter score: <#score description#>
133138
func onSingingScoreResult(score: Float)
134-
135-
139+
136140
/// 角色切换回调
137141
/// - Parameters:
138142
/// - oldRole: <#oldRole description#>
139143
/// - newRole: <#newRole description#>
140144
func onSingerRoleChanged(oldRole: KTVSingRole, newRole: KTVSingRole)
141145

146+
func onTokenPrivilegeWillExpire()
142147

143-
144-
func onTokenPrivilegeWillExpire()
145-
146148
/**
147149
* 合唱频道人声音量提示
148150
* @param speakers 不同用户音量信息
@@ -163,6 +165,8 @@ import AgoraRtcKit
163165
var chorusChannelToken: String
164166
var type: KTVType = .normal
165167
var maxCacheSize: Int = 10
168+
var musicType: loadMusicType = .mcc
169+
var isDebugMode: Bool = false
166170
@objc public
167171
init(appId: String,
168172
rtmToken: String,
@@ -172,7 +176,9 @@ import AgoraRtcKit
172176
chorusChannelName: String,
173177
chorusChannelToken: String,
174178
type: KTVType,
175-
maxCacheSize: Int
179+
maxCacheSize: Int,
180+
musicType: loadMusicType,
181+
isDebugMode: Bool
176182
) {
177183
self.appId = appId
178184
self.rtmToken = rtmToken
@@ -183,6 +189,8 @@ import AgoraRtcKit
183189
self.chorusChannelToken = chorusChannelToken
184190
self.type = type
185191
self.maxCacheSize = maxCacheSize
192+
self.musicType = musicType
193+
self.isDebugMode = isDebugMode
186194
}
187195
}
188196

@@ -192,6 +200,23 @@ import AgoraRtcKit
192200
public var autoPlay: Bool = false //是否加载完成自动播放
193201
public var mainSingerUid: Int = 0 //主唱uid
194202
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+
}
195220
}
196221

197222

@@ -331,16 +356,47 @@ public typealias JoinExChannelCallBack = ((Bool, KTVJoinChorusFailReason?)-> Voi
331356
/// - Parameter isOnMicOpen: <#isOnMicOpen description#>
332357
func setMicStatus(isOnMicOpen: Bool)
333358

334-
/// 获取mpk实例
335-
/// - Returns: <#description#>
336-
func getMediaPlayer() -> AgoraMusicPlayerProtocol?
359+
func getMusicPlayer() -> AgoraRtcMediaPlayerProtocol?
337360

338361
/// 获取MCC实例
339362
/// - Returns: <#description#>
340363
func getMusicContentCenter() -> AgoraMusicContentCenter?
341364

365+
// 开启专业主播模式
366+
func enableProfessionalStreamerMode(_ enable: Bool)
367+
342368
/**
343369
创建dataStreamID
344370
*/
345371
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+
346402
}

0 commit comments

Comments
 (0)