npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@whiteguru/capacitor-plugin-media

v6.0.1

Published

Capacitor plugin to handle media files

Downloads

107

Readme

@whiteguru/capacitor-plugin-media

Capacitor plugin to handle media files

Install (Capacitor 6.x)

npm install @whiteguru/capacitor-plugin-media
npx cap sync

or for Capacitor 5.x

npm install @whiteguru/capacitor-plugin-media@^5.0.2
npx cap sync

or for Capacitor 4.x

npm install @whiteguru/capacitor-plugin-media@^4.1.1
npx cap sync

or for Capacitor 3.x

npm install @whiteguru/capacitor-plugin-media@^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.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />

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

API

getMedias(...)

getMedias(options?: MediaFetchOptions | undefined) => Promise<MediasResponse>

Get list of user medias. IOS only

| Param | Type | | ------------- | --------------------------------------------------------------- | | options | MediaFetchOptions |

Returns: Promise<MediasResponse>


getAlbums()

getAlbums() => Promise<MediaAlbumResponse>

Get list of user albums. IOS and Android Api 29+

Returns: Promise<MediaAlbumResponse>


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>


createAlbum(...)

createAlbum(options: MediaAlbumCreate) => Promise<MediaAlbum>

Create album. IOS only

| Param | Type | | ------------- | ------------------------------------------------------------- | | options | MediaAlbumCreate |

Returns: Promise<MediaAlbum>


Interfaces

MediasResponse

| Prop | Type | | ------------ | ------------------------- | | medias | MediaAsset[] |

MediaAsset

| Prop | Type | Description | | --------------------- | ------------------------------------------------------- | ----------------------------------------------------------------------- | | identifier | string | Platform-specific identifier | | data | string | Data for a photo asset as a base64 encoded string (JPEG only supported) | | creationDate | string | ISO date string for creation date of asset | | fullWidth | number | Full width of original asset | | fullHeight | number | Full height of original asset | | thumbnailWidth | number | Width of thumbnail preview | | thumbnailHeight | number | Height of thumbnail preview | | location | MediaLocation | Location metadata for the asset |

MediaLocation

| Prop | Type | Description | | --------------- | ------------------- | ---------------------------------------- | | latitude | number | GPS latitude image was taken at | | longitude | number | GPS longitude image was taken at | | heading | number | Heading of user at time image was taken | | altitude | number | Altitude of user at time image was taken | | speed | number | Speed of user at time image was taken |

MediaFetchOptions

| Prop | Type | Description | | ---------------------- | ------------------- | --------------------------------------------------------------------- | | quantity | number | The number of photos to fetch, sorted by last created date descending | | thumbnailWidth | number | The width of thumbnail to return | | thumbnailHeight | number | The height of thumbnail to return | | thumbnailQuality | number | The quality of thumbnail to return as JPEG (0-100) | | types | string | Which types of assets to return (currently only supports "photos") | | albumIdentifier | string | Which album identifier to query in (get identifier with getAlbums()) |

MediaAlbumResponse

| Prop | Type | Description | | ------------ | ------------------------- | --------------------------------------------- | | albums | MediaAlbum[] | Array of MediaAlbum |

MediaAlbum

| Prop | Type | Description | | ---------------- | --------------------------------------------------------- | ---------------------------------- | | identifier | string | Platform-specific album identifier | | name | string | Album name | | type | MediaAlbumType | Album type |

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. |

MediaAlbumCreate

| Prop | Type | Description | | ---------- | ------------------- | ----------- | | name | string | Album name |

Enums

MediaAlbumType

| Members | Value | Description | | ------------ | --------------------- | -------------------------------------------------------------- | | Smart | 'smart' | Album is a "smart" album (such as Favorites or Recently Added) | | Shared | 'shared' | Album is a cloud-shared album | | User | 'user' | Album is a user-created album |