diff --git a/KTVAPI/iOS/Example/KTVApiDemo/KTVApiDemo/KTVViewController.swift b/KTVAPI/iOS/Example/KTVApiDemo/KTVApiDemo/KTVViewController.swift index fca9a3a..043cd58 100644 --- a/KTVAPI/iOS/Example/KTVApiDemo/KTVApiDemo/KTVViewController.swift +++ b/KTVAPI/iOS/Example/KTVApiDemo/KTVApiDemo/KTVViewController.swift @@ -32,7 +32,7 @@ class KTVViewController: UIViewController { let coSingerId = 2000 let audienceId = 3000 - let mccSongCode = 6625526603433040 + let mccSongCode = 7162848698410430 var lyricView: KTVLyricView! @@ -211,7 +211,7 @@ class KTVViewController: UIViewController { self.ktvApi.setLrcView(view: self.lyricView) self.ktvApi.addEventHandler(ktvApiEventHandler: self) - self.rtcKit.joinChannel(byToken: KeyCenter.Token, channelId: self.channelName, uid: UInt(self.userId), mediaOptions: self.mediaOptions()) + self.rtcKit.joinChannel(byToken: rtcToken, channelId: self.channelName, uid: UInt(self.userId), mediaOptions: self.mediaOptions()) self.loadMusic() } } diff --git a/KTVAPI/iOS/Example/KTVApiDemo/KTVApiDemo/KeyCenter.swift b/KTVAPI/iOS/Example/KTVApiDemo/KTVApiDemo/KeyCenter.swift new file mode 100644 index 0000000..06e385a --- /dev/null +++ b/KTVAPI/iOS/Example/KTVApiDemo/KTVApiDemo/KeyCenter.swift @@ -0,0 +1,49 @@ +// +// KeyCenter.swift +// OpenLive +// +// Created by GongYuhua on 6/25/16. +// Copyright © 2016 Agora. All rights reserved. +// +import Foundation + +@objcMembers +class KeyCenter: NSObject { + + /** + Agora APP ID. + Agora assigns App IDs to app developers to identify projects and organizations. + If you have multiple completely separate apps in your organization, for example built by different teams, + you should use different App IDs. + If applications need to communicate with each other, they should use the same App ID. + In order to get the APP ID, you can open the agora console (https://console.shengwang.cn/) to create a project, + then the APP ID can be found in the project detail page. + 声网APP ID + Agora 给应用程序开发人员分配 App ID,以识别项目和组织。如果组织中有多个完全分开的应用程序,例如由不同的团队构建, + 则应使用不同的 App ID。如果应用程序需要相互通信,则应使用同一个App ID。 + 进入声网控制台(https://console.shengwang.cn/),创建一个项目,进入项目配置页,即可看到APP ID。 + */ + + static let AppId: String = <#Your AppId#> + + /** + Certificate. + Agora provides App certificate to generate Token. You can deploy and generate a token on your server, + or use the console to generate a temporary token. + In order to get the APP ID, you can open the agora console (https://console.shengwang.cn/) to create a project with the App Certificate enabled, + then the APP Certificate can be found in the project detail page. + PS: If the project does not have certificates enabled, leave this field blank. + 声网APP证书 + Agora 提供 App certificate 用以生成 Token。您可以在您的服务器部署并生成,或者使用控制台生成临时的 Token。 + 进入声网控制台(https://console.shengwang.cn/),创建一个带证书鉴权的项目,进入项目配置页,即可看到APP证书。 + 注意:如果项目没有开启证书鉴权,这个字段留空。 + */ + + static let Certificate: String? = <#Your AppCertificate#> + + // cantata cloud server key + static let CloudPlayerKey: String? = "" + // cantata cloud server secret + static let CloudPlayerSecret: String? = "" + +} diff --git a/KTVAPI/iOS/Example/KTVApiDemo/KTVApiDemo/NetworkManager.swift b/KTVAPI/iOS/Example/KTVApiDemo/KTVApiDemo/NetworkManager.swift index 8a863df..2d3a14d 100644 --- a/KTVAPI/iOS/Example/KTVApiDemo/KTVApiDemo/NetworkManager.swift +++ b/KTVAPI/iOS/Example/KTVApiDemo/KTVApiDemo/NetworkManager.swift @@ -11,6 +11,7 @@ public let kAppProjectValue = "agora_ent_demo" public let kAppOS = "appOs" public let kAppOSValue = "iOS" public let kAppVersion = "versionName" +public let kAppAuthHeader = "" @objc class NetworkManager:NSObject { @@ -44,8 +45,8 @@ class NetworkManager:NSObject { kAppOS: kAppOSValue, kAppVersion: "0.0.1" ] - if KeyCenter.Token?.count ?? 0 > 0 { - config.httpAdditionalHeaders?["Authorization"] = KeyCenter.Token + if kAppAuthHeader.count > 0 { + config.httpAdditionalHeaders?["Authorization"] = kAppAuthHeader } config.timeoutIntervalForRequest = 30 config.timeoutIntervalForResource = 30