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

@@ -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()
}