co

cordova-open

Open audio, video, images and more with applications installed on the user's device

Showing:

Popularity

Downloads/wk

216

GitHub Stars

54

Maintenance

Last Commit

2yrs ago

Contributors

9

Package

Dependencies

0

License

MIT

Type Definitions

Tree-Shakeable

No?

Readme

cordova-open

Build Status Code Climate

Open audio, video, images and more with applications installed on the user's device.

Install

$ cordova plugin add cordova-open

Usage

var open = cordova.plugins.disusered.open;

function success() {
  console.log('Success');
}

function error(code) {
  if (code === 1) {
    console.log('No file handler found');
  } else {
    console.log('Undefined error');
  }
}

function progress(progressEvent) {
  if (progressEvent.lengthComputable) {
    var perc = Math.floor(progressEvent.loaded / progressEvent.total * 100);
    // update UI with status, for example:
    // statusDom.innerHTML = perc + "% loaded...";
  } else {
    // download does not offer a length... just show dots
    /*
       if(statusDom.innerHTML == "") {
       statusDom.innerHTML = "Loading";
       } else {
       statusDom.innerHTML += ".";
       }
     */
  }
};

open('file:/storage/sdcard/DCIM/Camera/1404177327783.jpg', success, error, progress);

API

The plugin exposes the following methods:

cordova.plugins.disusered.open(file, success, error, progress, trustAllCertificates)

Parameters:

  • file: A string representing a URI
  • success: Optional success callback
  • error: Optional error callback
  • progress: Optional progress callback
  • trustAllCertificates: Optional, trusts any certificate when the connection is done over HTTPS.

Events:

  • pause: Opening files emits Cordova's pause event (Android only)
  • resume: Closing the file emits Cordova's resume event
  • open.success: File is found and can be opened
  • open.error: File not found, or no file handler is installed

License

MIT © Carlos Rosquillas

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Tutorials

No tutorials found
Add a tutorial