@whiteguru/capacitor-plugin-media
v7.1.0
Published
Capacitor plugin to handle media files
Readme
@whiteguru/capacitor-plugin-media
Capacitor plugin to handle media files
Breaking Changes
Since version 7.0.2 the following methods have been removed:
getMedias()getAlbums()createAlbum()
Install (Capacitor 7.x)
npm install @whiteguru/capacitor-plugin-media
npx cap syncInstall (Capacitor 6.x)
npm install @whiteguru/capacitor-plugin-media@^6.0.2
npx cap syncor for Capacitor 5.x
npm install @whiteguru/capacitor-plugin-media@^5.0.2
npx cap syncor for Capacitor 4.x
npm install @whiteguru/capacitor-plugin-media@^4.1.1
npx cap syncor for Capacitor 3.x
npm install @whiteguru/capacitor-plugin-media@^3.0.1
npx cap syncAndroid
This API requires the following permissions be added to your AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29"/>Read about Setting Permissions in the Android Guide for more information on setting Android permissions.
API
savePhoto(...)
savePhoto(options?: MediaSaveOptions | undefined) => Promise<MediaResponse>Add image to gallery. Creates album if not exists.
| Param | Type |
| ------------- | ------------------------------------------------------------- |
| options | MediaSaveOptions |
Returns: Promise<MediaResponse>
saveVideo(...)
saveVideo(options?: MediaSaveOptions | undefined) => Promise<MediaResponse>Add video to gallery. Creates album if not exists.
| Param | Type |
| ------------- | ------------------------------------------------------------- |
| options | MediaSaveOptions |
Returns: Promise<MediaResponse>
saveGif(...)
saveGif(options?: MediaSaveOptions | undefined) => Promise<MediaResponse>Add gif to gallery. Creates album if not exists.
| Param | Type |
| ------------- | ------------------------------------------------------------- |
| options | MediaSaveOptions |
Returns: Promise<MediaResponse>
saveDocument(...)
saveDocument(options?: MediaSaveOptions | undefined) => Promise<MediaResponse>Add document to gallery. Android only. Create album if not exists.
| Param | Type |
| ------------- | ------------------------------------------------------------- |
| options | MediaSaveOptions |
Returns: Promise<MediaResponse>
saveAudio(...)
saveAudio(options?: MediaSaveOptions | undefined) => Promise<MediaResponse>Add audio to gallery. Android only. Creates album if not exists.
| Param | Type |
| ------------- | ------------------------------------------------------------- |
| options | MediaSaveOptions |
Returns: Promise<MediaResponse>
Interfaces
MediaResponse
| Prop | Type | Description |
| ---------- | ------------------- | ----------- |
| path | string | Media path |
| name | string | Media name |
MediaSaveOptions
| Prop | Type | Description |
| ----------- | -------------------------------------------- | ----------------------------------------------------------------------------------- |
| path | string | Path of file to add |
| album | { id?: string; name?: string; } | Album to add media. If no 'id' and 'name' not exists, album 'name' will be created. |
