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
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The following RTVI transports are available in this repository:
Add the following dependency to your `build.gradle` file:

```
implementation "ai.pipecat:daily-transport:1.0.3"
implementation "ai.pipecat:daily-transport:1.1.0"
```

Instantiate from your code:
Expand All @@ -32,7 +32,7 @@ val options = PipecatClientOptions(callbacks = callbacks)

val client: PipecatClientDaily = PipecatClient(DailyTransport(context), options)

client.startBotAndConnect(startBotParams).withCallback {
client.startBotAndConnect(apiRequest).withCallback {
// ...
}
```
Expand Down Expand Up @@ -125,23 +125,26 @@ client.connect().withCallback {
Add the following dependency to your `build.gradle` file:

```
implementation "ai.pipecat:small-webrtc-transport:0.3.7"
implementation "ai.pipecat:small-webrtc-transport:1.1.0"
```

Instantiate from your code:

```kotlin
val options = RTVIClientOptions(
params = RTVIClientParams(baseUrl = null),
enableMic = true,
enableCam = true
)
val callbacks = object : PipecatEventCallbacks() {

val connectionUrl = "http://localhost:7860/api/offer"
override fun onBackendError(message: String) {
Log.e(TAG, "Error from backend: $message")
}

val client = RTVIClient(SmallWebRTCTransport.Factory(context, connectionUrl), callbacks, options)
// ...
}

client.connect().withCallback {
val options = PipecatClientOptions(callbacks = callbacks)

val client: PipecatClientSmallWebRTC = PipecatClient(SmallWebRTCTransport(context), options)

client.startBotAndConnect(apiRequest).withCallback {
// ...
}
```
```
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dokka = "1.9.20"
androidxTest = "1.6.1"
ktor = "2.3.5"
okhttp = "4.12.0"
pipecatClient = "1.0.2"
pipecatClient = "1.1.0"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
Expand Down
2 changes: 1 addition & 1 deletion pipecat-client-android-daily/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
val libraryVersion = "1.0.3"
val libraryVersion = "1.1.0"

plugins {
alias(libs.plugins.android.library)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ai.pipecat.client.transport.MsgClientToServer
import ai.pipecat.client.transport.MsgServerToClient
import ai.pipecat.client.transport.Transport
import ai.pipecat.client.transport.TransportContext
import ai.pipecat.client.types.APIRequest
import ai.pipecat.client.types.MediaDeviceId
import ai.pipecat.client.types.MediaDeviceInfo
import ai.pipecat.client.types.Participant
Expand Down Expand Up @@ -238,7 +239,10 @@ class DailyTransport(
thread = ctx.thread
}

override fun deserializeConnectParams(json: String): DailyTransportConnectParams {
override fun deserializeConnectParams(
json: String,
startBotRequest: APIRequest
): DailyTransportConnectParams {
val authBundle: DailyTransportAuthBundle = JSON_INSTANCE.decodeFromString(json)

val room = authBundle.actualRoom() ?: throw Exception("dailyRoom not set")
Expand Down
20 changes: 13 additions & 7 deletions pipecat-client-android-small-webrtc-transport/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
val libraryVersion = "1.1.0"

plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.jetbrains.kotlin.android)
Expand All @@ -9,11 +11,12 @@ plugins {

android {
namespace = "ai.pipecat.client.small_webrtc_transport"
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 24
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "VERSION_NAME", "\"$libraryVersion\"")
}

buildTypes {
Expand All @@ -27,16 +30,20 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

lint {
targetSdk = 35
}

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "11"
}

buildFeatures {
buildConfig = true
}

sourceSets {
Expand All @@ -56,8 +63,7 @@ dependencies {
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.serialization.kotlinx.json)

// Temporary override until transport is updated to 1.0.0
api("ai.pipecat:client:0.3.4")
api(libs.pipecat.client)

androidTestImplementation(libs.androidx.runner)
androidTestImplementation(libs.androidx.rules)
Expand All @@ -76,7 +82,7 @@ publishing {
register<MavenPublication>("release") {
groupId = "ai.pipecat"
artifactId = "small-webrtc-transport"
version = "0.3.7"
version = libraryVersion

pom {
name.set("Small WebRTC Transport")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package ai.pipecat.client.small_webrtc_transport

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
internal data class IceCandidatesRequestBody(
@SerialName("pc_id")
val pcId: String,
val candidates: List<IceCandidateItem>,
)

@Serializable
internal data class IceCandidateItem(
val candidate: String,
@SerialName("sdp_mid")
val sdpMid: String?,
@SerialName("sdp_mline_index")
val sdpMLineIndex: Int,
)


Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package ai.pipecat.client.small_webrtc_transport

import kotlinx.serialization.Serializable

@Serializable
data class IceConfig(
val iceServers: List<IceServer>
)

@Serializable
data class IceServer(
val urls: List<String>,
val username: String? = null,
val credential: String? = null,
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ai.pipecat.client.small_webrtc_transport

import ai.pipecat.client.types.Value
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand All @@ -10,5 +11,7 @@ internal data class OfferRequestBody(
@SerialName("pc_id")
val pcId: String?,
@SerialName("restart_pc")
val restartPc: Boolean
val restartPc: Boolean,
@SerialName("request_data")
val requestData: Value
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package ai.pipecat.client.small_webrtc_transport

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
* Outbound signalling messages sent over the WebRTC data channel.
*/
@Serializable
internal data class OutboundSignallingEvent(
val type: String,
val message: TrackStatusMessage,
) {
companion object {
fun create(message: TrackStatusMessage) = OutboundSignallingEvent(
type = "signalling",
message = message
)
}
}

@Serializable
internal data class TrackStatusMessage(
val type: String,
@SerialName("receiver_index")
val receiverIndex: Int,
val enabled: Boolean,
) {
companion object {
fun create(receiverIndex: Int, enabled: Boolean) = TrackStatusMessage(
type = "trackStatus",
receiverIndex = receiverIndex,
enabled = enabled
)
}
}

internal object SmallWebRTCTransceiverIndex {
const val AUDIO: Int = 0
const val VIDEO: Int = 1
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package ai.pipecat.client.small_webrtc_transport

import ai.pipecat.client.PipecatClient

typealias PipecatClientSmallWebRTC = PipecatClient<SmallWebRTCTransport, SmallWebRTCTransportConnectParams>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package ai.pipecat.client.small_webrtc_transport

import kotlinx.serialization.Serializable

@Serializable
internal data class SmallWebRTCStartBotResult(
val sessionId: String,
val iceConfig: IceConfig? = null
)
Loading