I’m building a Discord-like app and I’ve decided to use self-hosted LiveKit for the streaming functionality.
I’m using the Flutter package to handle most of the abstractions, but based on my testing, there doesn’t seem to be a way to publish the audio track from screen sharing.
For example, on Windows I’d expect this to include the audio from the application or source being shared, while on Android it would be the device/system audio from the screen share.
Am I understanding this correctly? If so, what would be the best way to proceed? Would I need to write my own implementation for capturing and publishing screen-share audio?
@Drvm, You’re reading the API correctly. The Flutter SDK’s captureScreenAudio is documented as “for browser only, if true, will capture screen audio” [ livekit/client-sdk-flutter/lib/src/track/options.dart ]. The docs match: “Audio sharing is only possible in certain browsers” [ Screen sharing | LiveKit Documentation ]. So Flutter web is a flag flip; Android and Windows targets don’t get screen-share audio from the LK SDK today.
This is a platform constraint as much as a LK one. On Android the playback-capture path (MediaProjection + AudioPlaybackCaptureConfiguration, API 29+) and on Windows the WASAPI loopback path both have to be implemented in platform code outside the SDK before LK can publish that audio.
The shippable workaround: publish two separate tracks. Screen video goes out via the normal screen-share path, and a separate audio track captured natively gets published as a regular audio track in the same room. Remote side plays them together. You own the native audio code but don’t fork the SDK.