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

axiallon-capacitor-media-picker

v0.0.9

Published

Allows picking of all media types from a device

Downloads

4

Readme

media-picker

Allows picking of all media types from a device This is a fork of https://github.com/ionic-team/capacitor-plugins/tree/main/camera with many breaking changes and additional features

Install

npm install media-picker
npx cap sync

API

getPhoto(...)

getPhoto(options: MediaOptions) => Promise<Media>

Prompt the user to pick a photo from an album, or take a new photo with the camera.

| Param | Type | | ------------- | ----------------------------------------------------- | | options | MediaOptions |

Returns: Promise<Media>

Since: 1.0.0


pickMedia(...)

pickMedia(options: PickMediaOptions) => Promise<SelectedMedia>

Allows the user to pick multiple pictures from the photo gallery. On iOS 13 and older it only allows to pick one picture.

| Param | Type | | ------------- | ------------------------------------------------------------- | | options | PickMediaOptions |

Returns: Promise<SelectedMedia>

Since: 1.2.0


pickLimitedLibraryPhotos()

pickLimitedLibraryPhotos() => Promise<SelectedMedia>

iOS 14+ Only: Allows the user to update their limited photo library selection. On iOS 15+ returns all the limited photos after the picker dismissal. On iOS 14 or if the user gave full access to the photos it returns an empty array.

Returns: Promise<SelectedMedia>

Since: 4.1.0


getLimitedLibraryPhotos()

getLimitedLibraryPhotos() => Promise<SelectedMedia>

iOS 14+ Only: Return an array of photos selected from the limited photo library.

Returns: Promise<SelectedMedia>

Since: 4.1.0


checkPermissions()

checkPermissions() => Promise<PermissionStatus>

Check camera and photo album permissions

Returns: Promise<PermissionStatus>

Since: 1.0.0


requestPermissions(...)

requestPermissions(permissions?: MediaPickerPluginPermissions | undefined) => Promise<PermissionStatus>

Request camera and photo album permissions

| Param | Type | | ----------------- | ------------------------------------------------------------------------------------- | | permissions | MediaPickerPluginPermissions |

Returns: Promise<PermissionStatus>

Since: 1.0.0


compressVideo(...)

compressVideo(options: CompressVideoRequest) => Promise<CompressVideoResult>

| Param | Type | | ------------- | --------------------------------------------------------------------- | | options | CompressVideoRequest |

Returns: Promise<CompressVideoResult>


uploadFilePart(...)

uploadFilePart(options: UploadFilePartData) => Promise<{ base64Data: string; }>

| Param | Type | | ------------- | ----------------------------------------------------------------- | | options | UploadFilePartData |

Returns: Promise<{ base64Data: string; }>


Interfaces

Media

| Prop | Type | Description | Since | | -------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | | path | string | If using CameraResultType.Uri, the path will contain a full, platform-specific file URL that can be read later using the Filesystem API. | 1.0.0 | | webPath | string | webPath returns a path that can be used to set the src attribute of an image for efficient loading and rendering. | 1.0.0 | | contentType | string | The contentType of the media | 1.0.0 | | thumbnailPath | string | If using CameraResultType.Uri, the path will contain a full, platform-specific file URL that can be read later using the Filesystem API. | 1.0.0 | | thumbnailWebPath | string | webPath returns a path that can be used to set the src attribute of an image for efficient loading and rendering. | 1.0.0 | | thumbnailContentType | string | The contentType of the media's thumbnail | 1.0.0 | | saved | boolean | Whether if the image was saved to the gallery or not. On Android and iOS, saving to the gallery can fail if the user didn't grant the required permissions. On Web there is no gallery, so always returns false. | 1.1.0 |

MediaOptions

| Prop | Type | Description | Default | Since | | -------------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ----- | | quality | number | The quality of image to return as JPEG, from 0-100 | | 1.0.0 | | allowEditing | boolean | Whether to allow the user to crop or make small edits (platform specific). On iOS 14+ it's only supported for CameraSource.Camera, but not for CameraSource.Photos. | | 1.0.0 | | saveToGallery | boolean | Whether to save the photo to the gallery. If the photo was picked from the gallery, it will only be saved if edited. | : false | 1.0.0 | | width | number | The desired maximum width of the saved image. The aspect ratio is respected. | | 1.0.0 | | height | number | The desired maximum height of the saved image. The aspect ratio is respected. | | 1.0.0 | | maxVideoDimension | number | The maximum height/width of an image | | | | maxVideoThumbnailDimension | number | The maximum height/width of an image | | | | maxImageDimension | number | The maximum height/width of an image | | | | maxThumbnailDimension | number | The maximum height/width of a media asset's thumbnail | | | | correctOrientation | boolean | Whether to automatically rotate the image "up" to correct for orientation in portrait mode | : true | 1.0.0 | | source | CameraSource | The source to get the photo from. By default this prompts the user to select either the photo album or take a photo. | : CameraSource.Prompt | 1.0.0 | | mediaType | 'image' | 'video' | 'any' | The type of media to the selected. If set to "any" or undefined images and videos can be selected | : 'any' | | | multiple | boolean | Allows selection of multiple media items. | | | | direction | CameraDirection | iOS and Web only: The camera direction. | : CameraDirection.Rear | 1.0.0 | | presentationStyle | 'fullscreen' | 'popover' | iOS only: The presentation style of the Camera. | : 'fullscreen' | 1.0.0 | | webUseInput | boolean | Web only: Whether to use the PWA Element experience or file input. The default is to use PWA Elements if installed and fall back to file input. To always use file input, set this to true. Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements | | 1.0.0 | | promptLabelHeader | string | Text value to use when displaying the prompt. | : 'Photo' | 1.0.0 | | promptLabelCancel | string | Text value to use when displaying the prompt. iOS only: The label of the 'cancel' button. | : 'Cancel' | 1.0.0 | | promptLabelPhoto | string | Text value to use when displaying the prompt. The label of the button to select a saved image. | : 'From Photos' | 1.0.0 | | promptLabelPicture | string | Text value to use when displaying the prompt. The label of the button to open the camera. | : 'Take Picture' | 1.0.0 |

SelectedMedia

| Prop | Type | | ----------- | -------------------- | | media | Media[] |

PickMediaOptions

| Prop | Type | Description | Default | Since | | -------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------- | --------------------------- | ----- | | quality | number | The quality of image to return as JPEG, from 0-100 | | 1.2.0 | | width | number | The desired maximum width of the saved image. The aspect ratio is respected. | | 1.2.0 | | height | number | The desired maximum height of the saved image. The aspect ratio is respected. | | 1.2.0 | | correctOrientation | boolean | Whether to automatically rotate the image "up" to correct for orientation in portrait mode | : true | 1.2.0 | | presentationStyle | 'fullscreen' | 'popover' | iOS only: The presentation style of the Camera. | : 'fullscreen' | 1.2.0 | | limit | number | iOS only: Maximum number of pictures the user will be able to choose. | 0 (unlimited) | 1.2.0 | | maxVideoDimension | number | The maximum height/width of an image | | | | maxVideoThumbnailDimension | number | The maximum height/width of an image | | | | maxImageDimension | number | The maximum height/width of an image | | | | maxThumbnailDimension | number | The maximum height/width of a media asset's thumbnail | | | | mediaType | 'image' | 'video' | 'any' | The type of media to the selected. If set to "any" or undefined images and videos can be selected | : 'any' | | | multiple | boolean | Allows selection of multiple media items. | | |

PermissionStatus

| Prop | Type | | ------------ | ----------------------------------------------------------------------- | | camera | CameraPermissionState | | photos | CameraPermissionState |

MediaPickerPluginPermissions

| Prop | Type | | ----------------- | ----------------------------------- | | permissions | CameraPermissionType[] |

CompressVideoResult

| Prop | Type | | ----------------------- | ------------------- | | outputPath | string | | outputWebPath | string | | sourceVideoSize | string | | outputVideoSize | string | | outputContentType | string |

CompressVideoRequest

| Prop | Type | | ------------------ | ------------------- | | url | string | | maxDimension | number |

UploadFilePartData

| Prop | Type | | ----------------- | ------------------- | | url | string | | part | number | | partSize | number | | contentType | string | | partUrl | string |

Type Aliases

CameraPermissionState

PermissionState | 'limited'

PermissionState

'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'

CameraPermissionType

'camera' | 'photos'

Enums

CameraSource

| Members | Value | Description | | ------------ | --------------------- | ------------------------------------------------------------------ | | Prompt | 'PROMPT' | Prompts the user to select either the photo album or take a photo. | | Camera | 'CAMERA' | Take a new photo using the camera. | | Photos | 'PHOTOS' | Pick an existing photo from the gallery or photo album. |

CameraDirection

| Members | Value | | ----------- | -------------------- | | Rear | 'REAR' | | Front | 'FRONT' |