Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@whiteguru/capacitor-plugin-video-editor

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@whiteguru/capacitor-plugin-video-editor

Capacitor plugin to edit videos

  • 6.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
320
increased by11.89%
Maintainers
0
Weekly downloads
 
Created
Source

capacitor-plugin-video-editor

Capacitor plugin to edit videos

Install (Capacitor 6.x)

npm install @whiteguru/capacitor-plugin-video-editor
npx cap sync

or for Capacitor 5.x

npm install @whiteguru/capacitor-plugin-video-editor@^5.0.6
npx cap sync

or for Capacitor 4.x

npm install @whiteguru/capacitor-plugin-video-editor@^4.0.4
npx cap sync

or for Capacitor 3.x

npm install @whiteguru/capacitor-plugin-video-editor@^3.0.1
npx cap sync

Android

This API requires the following permissions be added to your AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>

You can also specify those permissions only for the Android versions where they will be requested:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>

The storage permissions are for reading video files.

Read about Setting Permissions in the Android Guide for more information on setting Android permissions.

Example

import {
  VideoEditor,
  MediaFileResult,
} from '@whiteguru/capacitor-plugin-video-editor';

const sourceVideoPath =
  'file:///var/mobile/Containers/Data/...../sourceVideo.mp4';

// Transcode with progress
const progressListener = await VideoEditor.addListener(
  'transcodeProgress',
  info => console.log('info', info),
);

VideoEditor.edit({
  path: sourceVideoPath,
  transcode: {
    width: 720,
    height: 480,
    keepAspectRatio: true,
  },
  trim: {
    startsAt: 3 * 1000, // from 00:03
    endsAt: 10 * 1000, // to 00:10
  },
}).then(
  (mediaFileResult: MediaFileResult) => {
    progressListener.remove();

    console.log('mediaPath', mediaFileResult.file.path);
  },
  error => {
    console.error('error', error);
  },
);

// Thumbnail
VideoEditor.thumbnail({
  path: sourceVideoPath,
  width: 150,
  height: 150,
  at: 4 * 1000, // at 00:04
}).then(
  (thumbMediaFileResult: MediaFileResult) => {
    console.log('thumbPath', thumbMediaFileResult.file.path);
  },
  error => {
    console.error('error', error);
  },
);

API

edit(...)

edit(options: EditOptions) => Promise<MediaFileResult>
ParamType
optionsEditOptions

Returns: Promise<MediaFileResult>


thumbnail(...)

thumbnail(options: ThumbnailOptions) => Promise<MediaFileResult>
ParamType
optionsThumbnailOptions

Returns: Promise<MediaFileResult>


addListener('transcodeProgress', ...)

addListener(eventName: 'transcodeProgress', listenerFunc: (info: ProgressInfo) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
ParamType
eventName'transcodeProgress'
listenerFunc(info: ProgressInfo) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


Interfaces

MediaFileResult
PropType
fileMediaFile
MediaFile
PropTypeDescription
namestringThe name of the file, without path information.
pathstringThe full path of the file, including the name.
typestringThe file's mime type
sizenumberThe size of the file, in bytes.
EditOptions
PropType
pathstring
trimTrimOptions
transcodeTranscodeOptions
TrimOptions
PropTypeDescription
startsAtnumberStartsAt in milliseconds
endsAtnumberEndsAt in milliseconds
TranscodeOptions
PropType
heightnumber
widthnumber
keepAspectRatioboolean
fpsnumber
ThumbnailOptions
PropTypeDescription
pathstring
atnumberThe time position where the frame will be retrieved in milliseconds.
widthnumber
heightnumber
PluginListenerHandle
PropType
remove() => Promise<void>
ProgressInfo
PropType
progressnumber

Keywords

FAQs

Package last updated on 11 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc