tencent cloud

Tencent Real-Time Communication

ScreenShareStore

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-11-11 22:02:34

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
Screen sharing status.

API List

Function
Description
shared
Singleton object.
Start screen sharing.
Stop screen sharing.
reset
Reset to default state.

Getting Instance

shared

Singleton object.

Screen Sharing

startScreenShare

Start screen sharing.
public func startScreenShare(appGroup: String) {
fatalError("\\(#function) must be overridden by subclass")
}
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
appGroup
String
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.

stopScreenShare

Stop screen capture.
public func stopScreenShare() {
fatalError("\\(#function) must be overridden by subclass")
}
Version
Supported since version 3.5.

Reset

reset

Reset to default state.
public func reset() {
fatalError("\\(#function) must be overridden by subclass")
}
Version
Supported since version 3.5.

Data Structures

ScreenShareState

Screen sharing state.
Property
Type
Description
screenStatus
Screen sharing status.

Usage Example

// Get singleton instance
let store = ScreenShareStore.shared
// Subscribe to state changes
store.state.subscribe { state in
print("Screen sharing status: \\(state.screenStatus)")
}
// Start screen sharing
store.startScreenShare(appGroup: "group.com.example.app")
// Stop screen sharing
store.stopScreenShare()

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백