MYBLMusicSDK
安装
MYBLMusicSDK 可通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中
pod 'MYBLMusicSDK'
SDK 初始化
在 AppDelegate 中使用 token 和回调代理进行 SDK 初始化过程
import MYBLShadhinSDK
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
//received music control from notification bar
application.beginReceivingRemoteControlEvents()
//initilize sdk with token
ShadhinBL.shared.initialize(with: "", delegate: self)
return true
}
从 AppDelegate 设置媒体控制
override func remoteControlReceived(with event: UIEvent?) {
if let event = event {
//register event
ShadhinBL.shared.eventRegister(with: event)
}
}
获取您需要的音乐主页控制器,必须传递根导航控制器以导航到音乐控制器和迷你播放器始终可见。
我们提供直接推送到导航控制器的功能
ShadhinBL.shared.gotoHome(with: self.tabBarController, navigationController: self.navigationController!)
我们还实现了其他可以直接导航到我们的控制器的功能
热门艺术家
ShadhinBL.shared.openPatch(patchID: FeatureType.POPULAR_ARTIST.rawValue, navigationController: self.navigationController!,tabController: self.tabBarController)
最新版本
ShadhinBL.shared.openPatch(patchID:FeatureType.LATEST_RELEASE.rawValue, navigationController: self.navigationController!,tabController: self.tabBarController)
热门视频
ShadhinBL.shared.openPatch(patchID: FeatureType.POPULAR_VIDEO.rawValue, navigationController: self.navigationController!,tabController: self.tabBarController)
播客
ShadhinBL.shared.openPatch(patchID: FeatureType.PODCAST.rawValue, navigationController: self.navigationController!,tabController: self.tabBarController)
AMAR调音
ShadhinBL.shared.openPatch(patchID: FeatureType.AMAR_TUNE.rawValue, navigationController: self.navigationController!,tabController: self.tabBarController)
AMAR调音Top 100
ShadhinBL.shared.openPatch(patchID: FeatureType.AMAR_TUNE_TOP_100.rawValue, navigationController: self.navigationController!,tabController: self.tabBarController)
导航到收音机
ShadhinBL.shared.gotoRadio(nav: self.navigationController!,tabController: self.tabBarController)
停止音乐
ShadhinBL.shared.stopMusic()
播放音乐
ShadhinBL.shared.playMusic()
暂停音乐
ShadhinBL.shared.pauseMusic()
清除所有缓存
ShadhinBL.shared.clearAllCache()
打开遥控代码
ShadhinBL.shared.openPatch(patchID: "MjM1OV9QREJD", navigationController: self.navigationController!, tabController: self.tabBarController)
权限
将 App Transport Security 添加到您的 info.plist 文件中
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
从项目的目标中添加签名和功能,然后选择“音频、AirPlay 和画中画”,“后台处理”以添加 Background Mood
作者
MD Azizur Rahman, [email protected]
公司
许可
MYBLMusicSDK 在 MIT 许可下可用。有关更多信息,请查阅 LICENSE 文件