Live Share
Note
The Live Share feature requires Univer Server support. Please ensure you have correctly installed and configured the Univer Server. For details, please refer to: Using Web SDK
The Live Share feature allows users to synchronize their view operations (such as scrolling and selection changes) with other followers in real-time during multi-person collaboration, or to follow the perspective of other users. This is very useful in scenarios such as meeting presentations and teaching explanations.
Plugin Mode
Installation
pnpm add @univerjs-pro/live-sharenpm install @univerjs-pro/live-shareyarn add @univerjs-pro/live-sharebun add @univerjs-pro/live-shareUsage
import { UniverLiveSharePlugin } from '@univerjs-pro/live-share'import { LocaleType, mergeLocales, Univer } from '@univerjs/core'import '@univerjs-pro/live-share/lib/index.css'import '@univerjs-pro/live-share/facade'const univer = new Univer({ // ...})univer.registerPlugin(UniverLiveSharePlugin)If you have a Univer commercial license, please refer to Using License in Client for configuration.
Facade API
The Live Share feature extends relevant interfaces in the Facade API, which you can call directly through univerAPI.
Import
Plugin mode note
Only plugin mode requires manually importing the Facade package. Preset mode already includes the corresponding Facade package, so no extra import is needed.
import '@univerjs-pro/live-share/facade'Status Enum
export enum LiveShareStatus { IDLE = 'idle', FOLLOWING = 'following', PRESENTING = 'presenting',}Usage Example
// Get current statusconst status = univerAPI.getLiveShareStatus()if (status === LiveShareStatus.IDLE) { // If currently idle, start presenting univerAPI.startPresenting()} else if (status === LiveShareStatus.PRESENTING) { // If presenting, stop presenting univerAPI.stopPresenting()}// Start followinguniverAPI.startFollowing()// Stop followinguniverAPI.stopFollowing()How is this guide?