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 🙏

© 2026 – Pkg Stats / Ryan Hefner

cordova-plugin-media-photo-picker

v3.0.1

Published

Android/iOS media picker using Photo Picker API - no broad media permissions required

Readme

MediaPicker v3.0.0

Android/iOS media picker plugin with Photo Picker API support - no broad media permissions required.

This fork removes READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, and READ_MEDIA_AUDIO permissions by using Android's native Photo Picker API (Android 13+) with fallback to ACTION_OPEN_DOCUMENT for older versions.

What's New in v3.0.0

  • No media permissions required - Uses Android Photo Picker API (Android 13+) and ACTION_OPEN_DOCUMENT (Android 12 and below)
  • Google Play compliant - Passes Google Play Store policy checks for media permissions
  • Removed external library dependency - No longer depends on com.github.DmcSDK:MediaPickerPoject
  • Backward compatible - Same JavaScript API as v2.x

Installation

cordova plugin add cordova-plugin-media-photo-picker --variable IOS_PHOTO_LIBRARY_USAGE_DESCRIPTION="your usage message"

Or from local path:

cordova plugin add /path/to/cordova-plugin-media-photo-picker --variable IOS_PHOTO_LIBRARY_USAGE_DESCRIPTION="your usage message"

Requirements

  • cordova-android: >= 10.0.0
  • Android SDK: 21+ (Android 5.0+)
  • iOS: 9.0+

Example

var args = {
    'selectMode': 101, // 101=image+video, 100=image only, 102=video only
    'maxSelectCount': 10, // default 10
};

MediaPicker.getMedias(args, function(medias) {
    // medias = [{
    //   mediaType: "image",
    //   path: '/data/user/0/.../cache/photo.jpg',
    //   uri: "file:///data/user/0/.../cache/photo.jpg",
    //   size: 21993,
    //   name: "photo.jpg",
    //   index: 0
    // }]
    console.log(medias);
}, function(error) {
    console.error(error);
});

Get Thumbnail

MediaPicker.extractThumbnail(media, function(data) {
    img.src = 'data:image/jpeg;base64,' + data.thumbnailBase64;
    img.style.transform = 'rotate(' + data.exifRotate + 'deg)';
}, function(error) {
    console.error(error);
});

Compress Image

media.quality = 50; // 1-100, 100 = original
MediaPicker.compressImage(media, function(compressedData) {
    console.log('Compressed path:', compressedData.path);
    console.log('New size:', compressedData.size);
}, function(error) {
    console.error(error);
});

Take Photo

MediaPicker.takePhoto({}, function(media) {
    console.log('Photo taken:', media.path);
}, function(error) {
    console.error(error);
});

API Reference

MediaPicker.getMedias(options, successCallback, errorCallback)

Opens the system photo picker to select images and/or videos.

Options:

  • selectMode (number): 100 = images only, 101 = images + videos, 102 = videos only
  • maxSelectCount (number): Maximum number of items to select (default: 10)
  • thumbnailQuality (number): Quality for thumbnail extraction (1-100, default: 50)
  • thumbnailW (number): Thumbnail width in pixels (default: 200)
  • thumbnailH (number): Thumbnail height in pixels (default: 200)

MediaPicker.takePhoto(options, successCallback, errorCallback)

Opens the camera to take a photo.

MediaPicker.extractThumbnail(media, successCallback, errorCallback)

Extracts a thumbnail from an image or video.

MediaPicker.compressImage(media, successCallback, errorCallback)

Compresses an image with specified quality.

MediaPicker.getFileInfo(pathOrUri, type, successCallback, errorCallback)

Gets file information from a path or URI.

MediaPicker.fileToBlob(path, successCallback, errorCallback)

Converts a file to a blob/byte array.

MediaPicker.getExifForKey(path, tag, successCallback, errorCallback)

Gets EXIF metadata for a specific tag.

Android Permissions

This plugin requires no media permissions on Android. It uses:

  • Android 13+: Native Photo Picker API (MediaStore.ACTION_PICK_IMAGES)
  • Android 12 and below: Storage Access Framework (ACTION_OPEN_DOCUMENT)

Only the CAMERA permission is requested for the takePhoto functionality.

iOS Permissions

On iOS, the plugin still requires photo library access. Add the usage description:

<config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
    <string>This app needs access to your photo library to select photos and videos.</string>
</config-file>

Migration from v2.x

The JavaScript API is fully backward compatible. Simply update the plugin:

  1. Remove the old plugin: cordova plugin rm cordova-plugin-mediapicker-dmcsdk (or cordova-plugin-media-photo-picker if upgrading from a prior v3 install)
  2. Add the new version: cordova plugin add cordova-plugin-media-photo-picker
  3. Rebuild your app

Note: The Android UI will now use the system photo picker instead of the custom gallery UI. This provides a consistent experience across all Android apps and ensures Google Play compliance.

License

ISC

Credits

Original plugin by DmcSDK

Photo Picker API implementation for Google Play compliance.