tencent cloud

Mobile Live Video Broadcasting

ScreenShareStore

ダウンロード
フォーカスモード
フォントサイズ
最終更新日: 2026-11-02 17:31:48
AI翻訳

Introduction

ScreenShareStore provides a complete set of screen sharing APIs, including full-screen sharing on mobile, and screen / window source enumeration and targeted sharing on desktop (Win/Mac).
Notice:
Use shared singleton to get the ScreenShareStore instance. Do not attempt to initialize directly.
Note:
Screen sharing state updates are delivered through the state publisher. Subscribe to it to receive real-time updates about screen sharing status.

Features

Screen Sharing: Start and stop screen sharing, with support for iOS App Group and desktop capture property configuration.
Source Enumeration: Enumerate shareable screens and application windows with thumbnails and icons for building source-picker UI (desktop only).
State Subscription: Real-time subscription to screen sharing state changes.

Subscribable Data

ScreenShareState fields are described below:
Property
Type
Description
screenStatus
ValueListenable<DeviceStatus>
Screen sharing status.

API List

Function
Description
shared
Singleton object.
Start screen sharing.
Enumerate shareable screens / windows (desktop only).
Stop screen sharing.
reset
Reset to default state.

Getting Instance

shared

Singleton object.

Screen Sharing

startScreenShare

Start screen sharing.
void startScreenShare({String iOSAppGroup = '', String? sourceId, ShareConfig? property});
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
iOSAppGroup
String
Defaults to '', which is the correct value for Android (ignored on the Android platform). On iOS, the value must match the App Group string configured in the Broadcast Upload Extension, used for sharing data between the host app and the Extension, in the format group.<reverse-domain>. Passing an empty string is allowed but does not guarantee screen sharing stability; configuring it correctly is recommended.
sourceId
String?
Desktop only (Win/Mac). The runtime handle of the screen / window to share, taken from ShareSource.sourceId returned by getShareSources. When null, no specific target is selected. The handle is volatile and must not be persisted; only pass it back while it is still live.
property
Desktop only (Win/Mac). Capture config, see ShareConfig. Uses default config when null.

getShareSources

Enumerate shareable screens / windows (desktop only).
Future<List<ShareSource>> getShareSources({required Size thumbnailSize, required Size iconSize});
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
thumbnailSize
Size
Desired thumbnail size for each source.
iconSize
Size
Desired icon size for each source.

stopScreenShare

Stop screen capture.
void stopScreenShare();
Version
Supported since version 3.5.

Reset

reset

Reset to default state.
void reset();
Version
Supported since version 3.5.

Data Structures

ShareSourceType

Share source type (desktop only).
Enum Value
Value
Description
window
0
An application window.
screen
1
A physical monitor / whole screen.

ShareSource

A shareable screen / window source (desktop only).
Property
Type
Description
type
Source type.
sourceId
String
Live runtime handle (HWND / CGWindowID), stringified. Do not persist.
sourceName
String
Source name at enumeration time. May be stale versus the live window title.
isMinimizeWindow
bool
Whether the window is minimized. Use it to hide or gray out minimized windows in the source-picker UI (minimized windows cannot be captured effectively).
thumbnail
ImageProvider?
Thumbnail image, may be null if not requested / unavailable.
icon
ImageProvider?
Icon image, may be null if not requested / unavailable.

ShareConfig

Share capture config (desktop only).
Property
Type
Description
enableCaptureMouse
bool
Whether to capture the mouse cursor. Defaults to true.

ScreenShareState

Screen sharing state.
Property
Type
Description
screenStatus
ValueListenable<DeviceStatus>
Screen sharing status.

Usage Example

// Get singleton instance
final store = ScreenShareStore.shared;
// Subscribe to state changes
store.state.screenStatus.addListener(() {
print('Screen sharing status: ${store.state.screenStatus.value}');
});
// Mobile: start screen sharing
store.startScreenShare(iOSAppGroup: 'group.com.example.app');
// Desktop: enumerate sources and share a specific target
final sources = await store.getShareSources(
thumbnailSize: const Size(320, 180),
iconSize: const Size(48, 48),
);
if (sources.isNotEmpty) {
store.startScreenShare(sourceId: sources.first.sourceId);
}
// Stop screen sharing
store.stopScreenShare();


ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック