Skip to content

Commit 9cd17e4

Browse files
fix: restore native Live Mode routing (reasonInLiveMode) - WebSocket audio/video streaming cannot go through WebView fetch()-based JS callers; this was an unintended regression from routing all online models to JS
1 parent aa42fe8 commit 9cd17e4

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

app/src/main/kotlin/com/google/ai/sample/feature/multimodal/PhotoReasoningViewModel.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,16 @@ class PhotoReasoningViewModel(
10581058
return
10591059
}
10601060

1061-
// All online built-in models are now handled by JavaScript in the WebView.
1061+
// Live API (real-time voice/video streaming over a persistent WebSocket) cannot be
1062+
// routed through a WebView fetch()-based JS caller - it needs bidirectional low-latency
1063+
// audio/video streaming infrastructure that only exists natively here (LiveApiManager).
1064+
// This is the one online model category that intentionally stays native.
1065+
if (isLiveMode) {
1066+
reasonInLiveMode(userInput, selectedImages, screenInfoForPrompt, imageUrisForChat, currentModel)
1067+
return
1068+
}
1069+
1070+
// All other online built-in models are handled by JavaScript in the WebView.
10621071
// JS (index.html, fetched from GitHub Pages) makes the API call and reports back
10631072
// via onCustomModelPartialResponse / onCustomModelFinalResponse.
10641073
reasonWithBuiltInModelViaJs(currentModel, userInput, selectedImages, screenInfoForPrompt, imageUrisForChat)

0 commit comments

Comments
 (0)