Skip to content

Commit 74b32c5

Browse files
authored
Dev sample 4.1.1.142 (#3)
KTVAPI v3.0.0 demo
1 parent f28de9e commit 74b32c5

File tree

79 files changed

+9049
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+9049
-1
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
**/android/.gradle
2+
.DS_Store
3+
local.properties
4+
.idea
5+
**/AgoraLyricsScore/*
6+
Pods
7+
**/*.xcworkspace/**
8+
**/xcuserdata
9+
**/*.lic
10+
**/libs/*
11+
**/buglyqq-upload-symbol/**
12+
**/build.sh

KTVAPI/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

KTVAPI/Android/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# KTV场景化Api sample demo
2+
3+
> 本文档主要介绍如何快速跑通 <mark>KTV场景化Api</mark> 示例工程,支持通过声网内容中心版权音乐和本地文件两种方式。
4+
>
5+
> k 歌流程
6+
> ![ktvapi_liucheng.png](image%2Fktvapi_liucheng.png)
7+
> Demo 效果:
8+
![Screenshot_20230814-114931.png](image/Screenshot_20230814-114931.png)
9+
![Screenshot_20230814-115006.png](image/Screenshot_20230814-115006.png)
10+
---
11+
12+
## 1. 环境准备
13+
14+
- <mark>最低兼容 Android 7.0</mark>(SDK API Level 24)
15+
- Android Studio 3.5及以上版本。
16+
- Android 7.0 及以上的手机设备。
17+
18+
---
19+
20+
## 2. 运行示例
21+
22+
- 获取声网 App ID -------- [声网Agora - 文档中心 - 如何获取 App ID](https://docs.agora.io/cn/Agora%20Platform/get_appid_token?platform=All%20Platforms#%E8%8E%B7%E5%8F%96-app-id)
23+
> - 点击创建应用
24+
>
25+
> ![xxx](https://accktvpic.oss-cn-beijing.aliyuncs.com/pic/github_readme/create_app_1.jpg)
26+
>
27+
> - 选择你要创建的应用类型
28+
>
29+
> ![xxx](https://accktvpic.oss-cn-beijing.aliyuncs.com/pic/github_readme/create_app_2.jpg)
30+
>
31+
> - 得到 App ID 与 App 证书
32+
>
33+
> ![xxx](https://accktvpic.oss-cn-beijing.aliyuncs.com/pic/github_readme/get_app_id.jpg)
34+
35+
- 获取 App 证书 ----- [声网Agora - 文档中心 - 获取 App 证书](https://docs.agora.io/cn/Agora%20Platform/get_appid_token?platform=All%20Platforms#%E8%8E%B7%E5%8F%96-app-%E8%AF%81%E4%B9%A6)
36+
37+
- <mark>联系销售给 AppID 开通 K 歌权限</mark>(如果您没有销售人员的联系方式可通过智能客服联系销售人员 [Agora 支持](https://agora-ticket.agora.io/))
38+
39+
- 注: 拉取榜单、歌单、歌词等功能是需要开通权限的
40+
41+
- 在项目的 [**local.properties**](../../local.properties) 里填写需要的声网 App ID 和 App 证书,服务器地址可以联系销售人员获取
42+
-
43+
![local_config.png](image%2Flocal_config.png)
44+
45+
```
46+
TOOLBOX_SERVER_HOST:获取 rtc token,rtm token
47+
AGORA_APP_ID:声网appid
48+
AGORA_APP_CERTIFICATE:声网Certificate
49+
```
50+
- 用 Android Studio 运行项目即可开始您的体验
51+
52+
---

KTVAPI/Android/app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

KTVAPI/Android/app/build.gradle

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
}
5+
6+
Properties properties = new Properties()
7+
InputStream inputStream = project.rootProject.file('local.properties').newDataInputStream()
8+
properties.load(inputStream)
9+
10+
android {
11+
namespace 'io.agora.ktvdemo'
12+
compileSdk 31
13+
14+
defaultConfig {
15+
applicationId "io.agora.ktvdemo"
16+
minSdk 21
17+
targetSdk 31
18+
versionCode 1
19+
versionName "1.0"
20+
21+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
22+
23+
buildConfigField "String", "TOOLBOX_SERVER_HOST", "\"${properties.getProperty("TOOLBOX_SERVER_HOST", "")}\""
24+
buildConfigField "String", "AGORA_APP_ID", "\"${properties.getProperty("AGORA_APP_ID", "")}\""
25+
buildConfigField "String", "AGORA_APP_CERTIFICATE", "\"${properties.getProperty("AGORA_APP_CERTIFICATE", "")}\""
26+
}
27+
28+
buildTypes {
29+
release {
30+
minifyEnabled false
31+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
32+
}
33+
}
34+
compileOptions {
35+
sourceCompatibility JavaVersion.VERSION_1_8
36+
targetCompatibility JavaVersion.VERSION_1_8
37+
}
38+
kotlinOptions {
39+
jvmTarget = '1.8'
40+
}
41+
buildFeatures {
42+
viewBinding true
43+
}
44+
45+
signingConfigs {
46+
release {
47+
keyAlias "key0"
48+
keyPassword "123456"
49+
storeFile file('./keystore/testkey.jks')
50+
storePassword "123456"
51+
}
52+
}
53+
54+
applicationVariants.configureEach { variant ->
55+
variant.outputs.configureEach {
56+
outputFileName = "KTVApiDemo-${versionName}-${variant.buildType.name}-${releaseTime()}.apk"
57+
}
58+
}
59+
}
60+
61+
dependencies {
62+
63+
implementation 'androidx.core:core-ktx:1.7.0'
64+
implementation 'androidx.appcompat:appcompat:1.4.1'
65+
implementation 'com.google.android.material:material:1.5.0'
66+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
67+
testImplementation 'junit:junit:4.13.2'
68+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
69+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
70+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1'
71+
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.1'
72+
implementation 'androidx.navigation:navigation-ui-ktx:2.4.1'
73+
implementation 'io.agora.rtc:agora-special-full:4.1.1.142'
74+
implementation 'com.github.AgoraIO-Community:LyricsView:1.1.1-beta.8'
75+
implementation 'com.google.code.gson:gson:2.10.1'
76+
implementation 'com.squareup.okhttp3:okhttp:3.12.0'
77+
implementation 'com.github.mrmike:ok2curl:0.8.0'
78+
}
79+
80+
static def releaseTime() {
81+
return new Date().format("yyyyMMdd_HHmmss")
82+
}
2.16 KB
Binary file not shown.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package io.agora.ktvdemo
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("io.agora.ktvdemo", appContext.packageName)
23+
}
24+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
7+
<uses-permission android:name="android.permission.CAMERA" />
8+
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
9+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
10+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
11+
<uses-permission android:name="android.permission.BLUETOOTH" />
12+
13+
<application
14+
android:name=".MyApplication"
15+
android:allowBackup="true"
16+
android:dataExtractionRules="@xml/data_extraction_rules"
17+
android:fullBackupContent="@xml/backup_rules"
18+
android:icon="@mipmap/app_ic_launcher"
19+
android:label="@string/app_name"
20+
android:roundIcon="@mipmap/app_ic_launcher_round"
21+
android:supportsRtl="true"
22+
android:theme="@style/app_Theme.AgoraKTV"
23+
tools:targetApi="31">
24+
<activity
25+
android:name=".ui.MainActivity"
26+
android:exported="true">
27+
<intent-filter>
28+
<action android:name="android.intent.action.MAIN" />
29+
30+
<category android:name="android.intent.category.LAUNCHER" />
31+
</intent-filter>
32+
</activity>
33+
</application>
34+
35+
</manifest>
23.7 MB
Binary file not shown.

0 commit comments

Comments
 (0)