Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
livekitAndroidXuningTest
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
David Zhao
2021-07-03 21:59:44 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
df713604694c3c58ca5fabed698b3f9c9a65669f
df713604
1 parent
73793e28
updated readme
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
90 行增加
和
27 行删除
.idea/inspectionProfiles/Project_Default.xml
README.md
build.gradle
release-instructions.md
sample-app/src/main/java/io/livekit/android/sample/MainActivity.kt
.idea/inspectionProfiles/Project_Default.xml
已删除
100644 → 0
查看文件 @
73793e2
<component
name=
"InspectionProjectProfileManager"
>
<profile
version=
"1.0"
>
<option
name=
"myName"
value=
"Project Default"
/>
<inspection_tool
class=
"KotlinThrowableNotThrown"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
</profile>
</component>
\ No newline at end of file
README.md
查看文件 @
df71360
#
client-sdk-android
#
Android Kotlin SDK for LiveKit
## Setup
Official Android Client SDK for
[
LiveKit
](
https://github.com/livekit/livekit-server
)
. Easily add video & audio capabilities to your Android apps.
Requires
`protocol`
repo to exist at the same level as this repo to generate protobufs correctly.
## Docs
### Optional (Dev convenience
)
Docs and guides at
[
https://docs.livekit.io
](
https://docs.livekit.io
)
1.
Download webrtc sources from https://webrtc.googlesource.com/src
2.
Add sources to Android Studio by pointing at the
`webrtc/sdk/android`
folder.
## Installation
LiveKit for Android is available as a Maven package.
```
groovy title="build.gradle"
...
dependencies {
implementation "io.livekit:livekit-android:<version>"
}
```
## Usage
LiveKit uses WebRTC-provided
`org.webrtc.SurfaceViewRenderer`
to render video tracks. Subscribed audio tracks are automatically played.
```
kt
class MainActivity : AppCompatActivity(), RoomListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...
val url = "wss://your_host";
val token = "your_token"
## Publishing releases
launch {
val room = LiveKit.connect(
applicationContext,
url,
token,
ConnectOptions(),
this
)
val localParticipant = room.localParticipant
val audioTrack = localParticipant.createAudioTrack()
localParticipant.publishAudioTrack(audioTrack)
val videoTrack = localParticipant.createVideoTrack()
localParticipant.publishVideoTrack(videoTrack)
videoTrack.startCapture()
1.
Ensure you have your
`.gradle/gradle.properties`
filled with the requisite credentials:
attachVideo(videoTrack, localParticipant)
}
}
```
`
nexusUsername=<sonatype username>
nexusPassword=<sonatype password>
signing.keyId=<signing key id>
signing.password=<signing key password>
signing.secretKeyRingFile=<signing pgp key path>
```
`
override fun onTrackSubscribed(
track: Track,
publication: RemoteTrackPublication,
participant: RemoteParticipant,
room: Room
) {
if (track is VideoTrack) {
attachVideo(track, participant)
}
}
2.
Update
`VERSION_NAME` in `gradle.properties`
to reflect the release version. (Remove "-SNAPSHOT" when releasing.)
3.
Run
`gradle publish closeAndReleaseRepository`
to upload to maven.
4.
Update
`VERSION_NAME` in `gradle.properties`
to prepare for next release version.
private fun attachVideo(videoTrack: VideoTrack, participant: Participant) {
// viewBinding.renderer is a `org.webrtc.SurfaceViewRenderer` in your
// layout
videoTrack.addRenderer(viewBinding.renderer)
}
}
```
## Dev Environment
To develop the Android SDK itself, you'll need
-
Check out the
[
protocol
](
https://github.com/livekit/protocol
)
repo to exist at the same level as this repo.
-
Install
[
Android Studio Arctic Fox Beta
](
https://developer.android.com/studio/preview
)
### Optional (Dev convenience)
1.
Download webrtc sources from https://webrtc.googlesource.com/src
2.
Add sources to Android Studio by pointing at the
`webrtc/sdk/android`
folder.
...
...
build.gradle
查看文件 @
df71360
...
...
@@ -11,7 +11,7 @@ buildscript {
}
dependencies
{
classpath
'com.android.tools.build:gradle:7.0.0-beta0
4
'
classpath
'com.android.tools.build:gradle:7.0.0-beta0
5
'
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath
"org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath
"org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
...
...
release-instructions.md
0 → 100644
查看文件 @
df71360
## Publishing releases
1.
Ensure you have your
`.gradle/gradle.properties`
filled with the requisite credentials:
```
`
nexusUsername=<sonatype username>
nexusPassword=<sonatype password>
signing.keyId=<signing key id>
signing.password=<signing key password>
signing.secretKeyRingFile=<signing pgp key path>
```
`
2.
Update
`VERSION_NAME` in `gradle.properties`
to reflect the release version. (Remove "-SNAPSHOT" when releasing.)
3.
Run
`gradle publish closeAndReleaseRepository`
to upload to maven.
4.
Update
`VERSION_NAME` in `gradle.properties`
to prepare for next release version.
...
...
sample-app/src/main/java/io/livekit/android/sample/MainActivity.kt
查看文件 @
df71360
...
...
@@ -108,8 +108,8 @@ class MainActivity : AppCompatActivity() {
const val PREFERENCES_KEY_URL = "url"
const val PREFERENCES_KEY_TOKEN = "token"
const val URL = "ws
://192.168.11.5:7880
"
const val URL = "ws
s://livekit.watercooler.fm
"
const val TOKEN =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE
2MTk0NDkwNTMsImlzcyI6IkFQSXdMZWFoN2c0ZnVMWURZQUplYUtzU0UiLCJqdGkiOiJwaG9uZTIiLCJuYmYiOjE2MTY4NTcwNTMsInZpZGVvIjp7InJvb20iOiJteXJvb20iLCJyb29tSm9pbiI6dHJ1ZX19.OiemzgYXe5269q_VDXb912LG3QoqoKy-52-xEWcTr3A
"
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE
5ODQyMzE0OTgsImlzcyI6IkFQSU1teGlMOHJxdUt6dFpFb1pKVjlGYiIsImp0aSI6ImZvcnRoIiwibmJmIjoxNjI0MjMxNDk4LCJ2aWRlbyI6eyJyb29tIjoibXlyb29tIiwicm9vbUpvaW4iOnRydWV9fQ.PVx_lXAIGxcD2VRslosrbkigc777GXbu-DQME8hjJKI
"
}
}
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论