This commit is contained in:
2026-01-14 11:46:52 +08:00
parent dca2a0b1e8
commit 2c01b1da9d
12 changed files with 796 additions and 49 deletions

View File

@@ -3,12 +3,9 @@ plugins {
id 'org.jetbrains.kotlin.android'
}
def sdkGroupId = rootProject.findProperty("sellySdkGroupId") ?: "com.sellycloud"
def sdkArtifactId = rootProject.findProperty("sellySdkArtifactId") ?: "sellycloudsdk"
def sdkVersion = rootProject.findProperty("sellySdkVersion") ?: "1.0.0"
def hasLocalSdk = rootProject.file("SellyCloudSDK").exists()
def sdkAarPath = "libs/${findProperty("sellySdkArtifactId") ?: "sellycloudsdk"}-${findProperty("sellySdkVersion") ?: "1.0.0"}.aar"
def releaseStorePath = project.rootProject.file(findProperty("MY_STORE_FILE") ?: "release.keystore")
def hasReleaseKeystore = releaseStorePath != null && releaseStorePath.exists()
def hasReleaseKeystore = releaseStorePath.exists()
android {
namespace 'com.demo.SellyCloudSDK'
@@ -67,34 +64,19 @@ android {
}
dependencies {
if (hasLocalSdk) {
implementation project(':SellyCloudSDK')
} else {
implementation files(
"libs/${sdkArtifactId}-${sdkVersion}.aar",
"libs/ijkplayer-cmake-release.aar",
"libs/Kiwi.aar",
"libs/libwebrtc.aar"
)
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.github.pedroSG94.RootEncoder:library:2.6.6'
}
implementation fileTree(
dir: "libs",
include: ["*.jar", "*.aar"],
exclude: [
"${sdkArtifactId}-${sdkVersion}.aar",
"ijkplayer-cmake-release.aar",
"Kiwi.aar",
"libwebrtc.aar"
]
implementation files(
sdkAarPath,
"libs/fu_core_all_feature_release.aar",
"libs/fu_model_all_feature_release.aar"
)
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.7.0-alpha03'
implementation 'androidx.constraintlayout:constraintlayout:2.2.0-alpha13'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
implementation 'androidx.core:core-ktx:1.13.1'
implementation "com.squareup.okhttp3:okhttp:4.12.0"
implementation 'androidx.constraintlayout:constraintlayout:2.2.0-alpha13'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.activity:activity-ktx:1.9.2'
@@ -102,7 +84,6 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.8.4'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation "com.squareup.okhttp3:okhttp:4.12.0"
implementation "io.coil-kt:coil:2.6.0"
testImplementation 'junit:junit:4.13.2'

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -173,7 +173,7 @@ class InteractiveLiveActivity : AppCompatActivity() {
val token = getString(R.string.signaling_token).takeIf { it.isNotBlank() }
val kiwiRsName = getString(R.string.signaling_kiwi_rsname).trim()
beautyRenderer = FURenderer(this).also { it.setup() }
fuFrameInterceptor = beautyRenderer?.let { FuVideoFrameInterceptor(it).apply {
fuFrameInterceptor = beautyRenderer?.let { FuVideoFrameInterceptor(it).apply {
setFrontCamera(isFrontCamera)
setEnabled(beautyEnabled)
} }

View File

@@ -125,14 +125,6 @@ class LivePlayActivity : AppCompatActivity() {
}
updatePreviewVisibility()
logEvent("状态变更: ${formatState(state)}")
if (state == SellyPlayerState.Playing && firstVideoFrameElapsedMs == null) {
val startMs = playAttemptStartElapsedMs
firstVideoFrameElapsedMs = SystemClock.elapsedRealtime()
if (startMs != null) {
firstVideoFrameCostMs = firstVideoFrameElapsedMs!! - startMs
logEvent("首帧视频耗时=${firstVideoFrameCostMs}ms")
}
}
}
}
@@ -140,6 +132,11 @@ class LivePlayActivity : AppCompatActivity() {
runOnUiThread {
hasFirstVideoFrameRendered = true
updatePreviewVisibility()
if (firstVideoFrameElapsedMs != null) return@runOnUiThread
val startMs = playAttemptStartElapsedMs ?: return@runOnUiThread
firstVideoFrameElapsedMs = SystemClock.elapsedRealtime()
firstVideoFrameCostMs = firstVideoFrameElapsedMs!! - startMs
logEvent("首帧视频耗时=${firstVideoFrameCostMs}ms")
}
}

View File

@@ -220,8 +220,10 @@ class LivePushActivity : AppCompatActivity() {
try {
val videoConfig = buildVideoConfig(settings)
pusherClient.setVideoConfiguration(videoConfig)
pusherClient.attachPreview(binding.previewContainer)
pusherClient.startRunning(currentFacing, videoConfig, null)
applyStreamConfig(settings)
} catch (t: Throwable) {
Toast.makeText(this, "初始化预览失败: ${t.message}", Toast.LENGTH_LONG).show()
}