# Live Share

- Human documentation: [https://docs.univer.ai/guides/sheets/features/live-share](https://docs.univer.ai/guides/sheets/features/live-share)

- Agent Markdown: [https://docs.univer.ai/guides/sheets/features/live-share.md](https://docs.univer.ai/guides/sheets/features/live-share.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [sheets/features/live-share.mdx](https://github.com/dream-num/documentation/blob/dev/content/guides/sheets/features/live-share.mdx)

---

#### Package metadata

```json
{
  "plugins": [
    {
      "client": "@univerjs-pro/live-share",
      "facade": "@univerjs-pro/live-share/facade",
      "style": "@univerjs-pro/live-share/lib/index.css"
    }
  ],
  "server": true
}
```

> [!WARNING: 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](https://docs.univer.ai/server/license.md)

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

#### npm

```bash
npm install @univerjs-pro/live-share
```

#### pnpm

```bash
pnpm add @univerjs-pro/live-share
```

#### yarn

```bash
yarn add @univerjs-pro/live-share
```

#### bun

```bash
bun add @univerjs-pro/live-share
```

### Usage

```typescript
import { UniverLiveSharePlugin } from '@univerjs-pro/live-share' // [!code ++]
import { LocaleType, mergeLocales, Univer } from '@univerjs/core'

import '@univerjs-pro/live-share/lib/index.css' // [!code ++]

import '@univerjs-pro/live-share/facade' // [!code ++]

const univer = new Univer({
  // ...
})

univer.registerPlugin(UniverLiveSharePlugin)
```

If you have a Univer commercial license, please refer to [Using License in Client](https://docs.univer.ai/server/license.md#in-plugin-mode) for configuration.

## Facade API

The Live Share feature extends relevant interfaces in the Facade API, which you can call directly through `univerAPI`.

### Import

> [!INFO: 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.

```typescript
import '@univerjs-pro/live-share/facade'
```

### Status Enum

```typescript
export enum LiveShareStatus {
  IDLE = 'idle',
  FOLLOWING = 'following',
  PRESENTING = 'presenting',
}
```

### Usage Example

```typescript
// Get current status
const 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 following
univerAPI.startFollowing()

// Stop following
univerAPI.stopFollowing()
```
