Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions KTVAPI/Android/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# K 歌场景化 API 示例 demo

> 本文档主要介绍如何快速跑通 K 歌场景化 API 示例工程,本 demo 支持普通合唱、大合唱两种模式, 包含加载、播放声网内容中心版权音乐和本地音乐文件等功能
> 本文档主要介绍如何快速跑通 K 歌场景化 API 示例工程,本 demo 支持普通合唱、大合唱两种模式, 包含加载、播放声网内容中心版权音乐、本地音乐文件、声网 Ex 歌曲等功能
>
> **Demo 效果:**
>
> <img src="https://accktvpic.oss-cn-beijing.aliyuncs.com/pic/github_readme/ktv/ktvapi_demo3.jpg" width="300" height="640"><img src="https://accktvpic.oss-cn-beijing.aliyuncs.com/pic/github_readme/ktv/ktvapi_demo4.jpg" width="300" height="640">
> <img src="https://accktvpic.oss-cn-beijing.aliyuncs.com/pic/github_readme/ktv/ktvapi_demo5.png" width="300" height="640"><img src="https://accktvpic.oss-cn-beijing.aliyuncs.com/pic/github_readme/ktv/ktvapi_demo6.png" width="300" height="640">
---

## 1. 环境准备
Expand Down Expand Up @@ -52,6 +52,7 @@
# RTM RTC SDK key Config
AGORA_APP_ID:声网 APP ID
AGORA_APP_CERTIFICATE:声网 APP 证书
# Cloud Player Config
RESTFUL_API_KEY:声网RESTful API key
RESTFUL_API_SECRET:声网RESTful API secret
```
Expand Down
18 changes: 15 additions & 3 deletions KTVAPI/Android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ properties.load(inputStream)

android {
namespace 'io.agora.ktvdemo'
compileSdk 31
compileSdk 33

defaultConfig {
applicationId "io.agora.ktvdemo"
minSdk 21
targetSdk 31
targetSdk 33
versionCode 1
versionName "1.0"

Expand All @@ -25,6 +25,11 @@ android {
buildConfigField "String", "AGORA_APP_CERTIFICATE", "\"${properties.getProperty("AGORA_APP_CERTIFICATE", "")}\""
buildConfigField "String", "RESTFUL_API_KEY", "\"${RESTFUL_API_KEY}\""
buildConfigField "String", "RESTFUL_API_SECRET", "\"${RESTFUL_API_SECRET}\""

buildConfigField "String", "EX_APP_ID", "\"${properties.getProperty("EX_APP_ID", "")}\""
buildConfigField "String", "EX_APP_Key", "\"${properties.getProperty("EX_APP_Key", "")}\""
buildConfigField "String", "EX_APP_TOKEN", "\"${properties.getProperty("EX_APP_TOKEN", "")}\""
buildConfigField "String", "EX_USERID", "\"${properties.getProperty("EX_USERID", "")}\""
}

buildTypes {
Expand Down Expand Up @@ -80,11 +85,18 @@ dependencies {
implementation 'com.github.mrmike:ok2curl:0.8.0'

// 歌词组件
implementation 'com.github.AgoraIO-Community:LyricsView:1.1.1-beta.8'
implementation 'com.github.AgoraIO-Community:LyricsView:1.1.4'

// 歌词组件 Ex
implementation 'io.github.winskyan:Agora-LyricsViewEx:2.0.0.130'
//
implementation 'io.agora:authentication:1.6.1'
// ktvapi
api project(":lib_ktvapi")
api project(":lib_ktvapi_ex")

// runtimeOnly project(':lib_ktvapi')
// runtimeOnly project(':lib_ktvapi_ex')
}

static def releaseTime() {
Expand Down
4 changes: 2 additions & 2 deletions KTVAPI/Android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/app_ic_launcher"
android:icon="@mipmap/app_ktv_ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/app_ic_launcher_round"
android:roundIcon="@mipmap/app_ktv_ic_launcher"
android:supportsRtl="true"
android:theme="@style/app_Theme.AgoraKTV"
android:networkSecurityConfig="@xml/network_security_config"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class CloudApiManager private constructor() {
return token
}

fun fetchStartCloud(mainChannel: String, inputToken: String, outputToken: String) {
fun fetchStartCloud(mainChannel: String, inputRtcUid: Int, inputToken: String, outputToken: String) {
val token = fetchCloudToken()
tokenName = token.ifEmpty {
Log.e(TAG, "云端合流uid 请求报错 token is null")
Expand All @@ -87,7 +87,7 @@ class CloudApiManager private constructor() {
try {
val transcoderObj = JSONObject()
val inputRetObj = JSONObject()
.put("rtcUid", 0)
.put("rtcUid", inputRtcUid)
.put("rtcToken", inputToken)
.put("rtcChannel", mainChannel)
val intObj = JSONObject()
Expand Down Expand Up @@ -195,7 +195,7 @@ class CloudApiManager private constructor() {
return "Basic $base64Credentials"
}

private fun getString(resId:Int):String{
private fun getString(resId: Int): String {
return MyApplication().getString(resId)
}
}
Loading