@capgo/capacitor-screen-recorder

中文文档
8.4.7发布于 2026/11/09MPL-2.0TypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 4.3万

Record device's screen

原始使用文档
文档目录18 节
  1. ➡️ Get started for free
  2. Key features
  3. Documentation
  4. Compatibility
  5. Install
  6. IOS
  7. Android
  8. Add JitPack Repository
  9. Variables
  10. Configuration
  11. API
  12. start(...)
  13. stop()
  14. addListener('onStopped', ...)
  15. removeAllListeners()
  16. getPluginVersion()
  17. Interfaces
  18. Type Aliases

Capacitor-screen-recorder

Record the device screen from your Capacitor app, with optional audio, for bug reports, tutorials and demos.

Capgo - Build Capacitor apps with AI, ship updates instantly

Capgo: push fixes to your Capacitor users in minutes, build signed iOS and Android apps without a Mac, and roll back in one click.

➡️ Get started for free

14-day unlimited free trial. No credit card required

🤖 Building with an AI coding agent? Install Capgo skills so Claude Code, Codex, Cursor, Copilot, or Gemini CLI know how to install and use @capgo/capacitor-screen-recorder in your Capacitor app: npx skills add Cap-go/capgo-skills. Then ask your agent: "Add @capgo/capacitor-screen-recorder to my Capacitor app and wire it up." Agent setup guides · Hosted MCP

@capgo/capacitor-screen-recorder for Capacitor apps

Key features

  • Start: start() begins recording after the system consent prompt.
  • Stop: stop() ends the recording.
  • Audio: set recordAudio to capture sound with the video.
  • Native capture: ReplayKit on iOS, saved to the Photos library, and MediaProjection on Android.
  • Platforms: iOS and Android. Not available on web.

Documentation

The most complete doc is available here: https://capgo.app/docs/plugins/screen-recorder/

Compatibility

Plugin versionCapacitor compatibilityMaintained
v8.*.*v8.*.*✅
v7.*.*v7.*.*On demand
v6.*.*v6.*.*❌
v5.*.*v5.*.*❌

Note: The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.

Install

You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:

npx skills add https://github.com/cap-go/capacitor-skills --skill capacitor-plugins

Then use the following prompt:

Use the `capacitor-plugins` skill from `cap-go/capacitor-skills` to install the `@capgo/capacitor-screen-recorder` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

npm install @capgo/capacitor-screen-recorder
npx cap sync

IOS

add NSPhotoLibraryAddUsageDescription in your info.plist

Android

increase project's minSdk version to 23, it's required by the dependency HBRecorder

Add these permissions in your AndroidManifest.xml:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />

Add JitPack Repository

Add JitPack repository to your Android app's build.gradle (android/app/build.gradle):

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io/' }
    }
}

Variables

This plugin will use the following project variables (defined in your app's variables.gradle file):

  • $kotlinVersion version of org.jetbrains.kotlin:kotlin-stdlib-jdk7 (default: 1.7.21)

If you have compilation issue Duplicate class androidx.lifecycle.ViewModelLazy i found in this the solution who worked for me: https://stackoverflow.com/questions/73406969/duplicate-class-androidx-lifecycle-viewmodellazy-found-in-modules-lifecycle-view

Add this

configurations {
    all {
        exclude group: 'androidx.lifecycle', module: 'lifecycle-runtime-ktx'
        exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'
    }
}
an

line 2 in file android/app/build.gradle

Configuration

No configuration required for this plugin.

API

Capacitor Screen Recorder Plugin for recording the device screen. Allows you to capture video recordings of the screen with optional audio.

start(...)

start(options?: StartRecordingOptions | undefined) => Promise<void>

Start recording the device screen.

Initiates screen recording with optional audio capture. The user will be prompted to grant screen recording permissions if not already granted. On iOS, the system recording UI will be displayed. On Android, the recording starts immediately after permission is granted.

ParamTypeDescription
optionsStartRecordingOptions- Recording configuration options

Since: 1.0.0


stop()

stop() => Promise<void>

Stop the current screen recording.

Stops the active screen recording and saves the video to the device's camera roll or gallery. On iOS, the system will show a preview of the recording. On Android, the video is saved directly to the gallery.

Since: 1.0.0


addListener('onStopped', ...)

addListener(eventName: 'onStopped', listenerFunc: (event: ScreenRecorderStoppedEvent) => void) => Promise<PluginListenerHandle>

Listen for recordings that ended without {@link stop} being called.

ParamTypeDescription
eventName'onStopped'- onStopped
listenerFunc(event: ScreenRecorderStoppedEvent) => void- Called with a ScreenRecorderStoppedEvent (url and optional error) when the recording ended outside stop().

Returns: Promise<PluginListenerHandle>

Since: 8.4.0


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all listeners registered with {@link addListener}.

Since: 8.4.0


getPluginVersion()

getPluginVersion() => Promise<{ version: string; }>

Get the native Capacitor plugin version.

Returns: Promise<{ version: string; }>

Since: 1.0.0


Interfaces

StartRecordingOptions

Options for {@link ScreenRecorderPlugin.start}.

PropTypeDescriptionDefaultSince
recordAudiobooleanWhether to record audio along with the screen video.false1.0.0
formatScreenRecorderVideoFormat | 'video/mp4' | 'video/quicktime'Video container format for the saved recording. Accepts mp4, mov, or MIME types video/mp4 and video/quicktime. iOS supports both mp4 and mov. Android records MPEG-4 (.mp4) regardless of this value.'mp4'8.3.0

PluginListenerHandle

PropType
remove() => Promise<void>

ScreenRecorderStoppedEvent

Payload for the onStopped event.

Fired when a recording ends without {@link ScreenRecorderPlugin.stop} being called: the user stopped capture from the system UI (Android "Stop sharing"), the recorder hit a limit (max duration or max file size), or the system interrupted capture (iOS, for example an incoming call).

PropTypeDescriptionSince
urlstringLocal URI of the finished recording (file:// on Android). Empty string when the file path could not be resolved.8.4.0
errorstringError message when the recording ended with a failure.8.4.0

Type Aliases

ScreenRecorderVideoFormat

Supported video container formats for screen recordings.

'mp4' | 'mov'

版本与发布记录

@capgo/capacitor-screen-recorder 共发布 271 个版本,首次发布于 2022/07/24;过去 12 个月发布了 72 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
8.4.7latest2026/11/09今天
8.4.62026/11/026 天前
8.4.52026/10/2613 天前
8.4.42026/10/1921 天前
8.4.32026/10/1525 天前
8.4.22026/10/1327 天前

关于 @capgo/capacitor-screen-recorder 的常见问题

@capgo/capacitor-screen-recorder 是什么?

Record device's screen

如何安装 @capgo/capacitor-screen-recorder?

在项目目录运行 npm install @capgo/capacitor-screen-recorder,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@capacitor/core(>=8.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@capgo/capacitor-screen-recorder 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@capgo/capacitor-screen-recorder 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@capgo/capacitor-screen-recorder 可以商用吗?

@capgo/capacitor-screen-recorder 使用 MPL-2.0 许可。弱 Copyleft:可以商用,也可以和闭源代码一起使用;但如果分发时修改了 MPL 授权的文件,这些文件的修改需以 MPL 开源。以上为概括,不构成法律意见,请以许可原文为准。

@capgo/capacitor-screen-recorder 的下载量有多少?

根据 npm 官方下载统计,@capgo/capacitor-screen-recorder 在 2026/10/09 – 2026/11/07 这 30 天内被下载 43,489 次,日均约 1,450 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@capgo/capacitor-screen-recorder 还在维护吗?

最新版本 8.4.7 发布于 2026/11/09(今天);至今共发布 271 个版本,其中过去 12 个月发布了 72 个;首次发布于 2022/07/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。