npm install @capgo/capacitor-screen-recorder
npx cap sync
add NSPhotoLibraryUsageDescription in your info.plist
increase project's minSdk version to 23, it's required by the dependency scrcast
Add this permissions in your AndroidManifest.xml
<uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
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
No configuration required for this plugin.
start() => any
start the recording
Returns: any
stop() => any
stop the recording
Returns: any
A Capacitor plugin for recording the device's screen.
To install the package, run the following command:
npm install @capgo/capacitor-screen-recorder
npx cap sync
Make sure to add the necessary permissions and configurations for the plugin to work properly.
To start recording the screen, use the start()
method:
import { Plugins } from '@capacitor/core';
const { CapacitorScreenRecorder } = Plugins;
CapacitorScreenRecorder.start();
To stop the recording, use the stop()
method:
import { Plugins } from '@capacitor/core';
const { CapacitorScreenRecorder } = Plugins;
CapacitorScreenRecorder.stop();
That's it! You can now record the screen of your device using the Capacitor Screen Recorder plugin.
Add this permissions
<uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
This plugin is compatible with Capacitor 4 and above.
Contributions to this plugin are greatly appreciated. If you encounter any issues or have any suggestions, please feel free to submit a pull request or create an issue on the GitHub repository.
This package is licensed under the MIT License.