calm-article-62769
11/10/2025, 7:35 PMtall-airline-16756
11/10/2025, 7:36 PMtall-airline-16756
11/10/2025, 7:36 PMImageContent object. This supports base64-encoded data URLs, external URLs, or direct video frame objects from tracks.
LiveKit is designed to work with both traditional STT-LLM-TTS pipelines and real-time models. These real-time models handle speech input and output directly, with integrated STT and TTS, or you can pair them with external TTS providers if you want a more customized speech experience.
For instance, you can capture the latest video frame during speech detection and add it to the LLM context for enhanced multimodal reasoning. This is beautifully demonstrated in the Vision Agent example, which processes live video from a user’s camera or screen sharing, combines it with STT transcriptions, and responds using TTS.
If you’d like more details or need a hand with implementation, please don’t hesitate to reach out—I’m here to help!
Sources: Realtime model plugins | LiveKit Docs | Real-time AI Models & Streaming | livekit/livekit_composite | DeepWiki | docs/index.yaml | Vision | LiveKit Docs | livekit-agents/livekit/agents/voice/agent.pycalm-article-62769
11/10/2025, 7:41 PMtall-airline-16756
11/10/2025, 7:43 PMimport logging
from livekit.agents import (
Agent, AgentSession, JobContext, RoomInputOptions, RoomOutputOptions, WorkerOptions, cli, voice,
)
from livekit.plugins import google, silero
logger = logging.getLogger("screen-share-agent")
async def entrypoint(ctx: JobContext):
session = AgentSession(
vad=silero.VAD.load(),
llm=google.realtime.RealtimeModel(
model="gemini-2.0-flash-live-001",
voice="Puck",
temperature=0.8,
instructions="You are an AI assistant that interacts with users via voice and can see their screen."
),
)
agent = Agent(
instructions="You are an AI assistant that can see and discuss what users show on their screen through screen sharing."
)
await session.start(
agent=agent,
room=ctx.room,
room_input_options=RoomInputOptions(video_enabled=True),
room_output_options=RoomOutputOptions(transcription_enabled=True),
)
await session.generate_reply(
instructions="Greet the user and ask what they’d like help with on their screen."
)
if __name__ == "__main__":
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
Frontend Implementation
For the web (React), you’ll want to enable screen sharing in app-config.ts like this:
export const APP_CONFIG_DEFAULTS: AppConfig = {
supportsVideoInput: true,
supportsScreenShare: true,
}
And for Android, you can use MediaProjectionManager to manage screen capture permissions and enable screen sharing smoothly.
Video Frame Processing
To optimize performance, video frames are sampled based on voice activity:
• 1 frame per second while speaking
• 0.3 frames per second when silent
Frames are JPEG-encoded with a max resolution of 1024×1024 pixels. If you want to customize this, here’s how you can adjust it:
session = AgentSession(
vad=silero.VAD.load(),
llm=google.realtime.RealtimeModel(),
video_sampler=voice.VoiceActivityVideoSampler(
speaking_fps=2.0,
silent_fps=0.5,
),
)
Authentication
Don’t forget to set these environment variables to keep things running smoothly:
LIVEKIT_URL=your-livekit-instance-url
LIVEKIT_API_KEY=your-api-key
LIVEKIT_API_SECRET=your-api-secret
GOOGLE_API_KEY=your-google-api-key
Reference Implementations
• Vision Demo: An iOS app showcasing screen sharing and Gemini integration
• Agent Starter React: A web app with screen share support
• Android Voice Assistant: Android implementation featuring screen sharing
If you have any questions or need me to clarify any part, please don’t hesitate to ask. I’m here to help you every step of the way!
Sources: Gemini Live API plugin | LiveKit docs | livekit-plugins/livekit-plugins-google/livekit/plugins/google/realtime/real... | Gemini Live API plugin | LiveKit docs | README.md | app/src/main/java/io/livekit/android/example/voiceassistant/screen/VoiceAss...