Giter Site home page Giter Site logo

hanho-kim / media Goto Github PK

View Code? Open in Web Editor NEW

This project forked from capacitor-community/media

0.0 0.0 0.0 529 KB

Capacitor plugin to activate extra media features

Home Page: https://capacitor.ionicframework.com/docs/

Ruby 2.34% Java 20.67% Objective-C 1.44% Swift 29.40% JavaScript 3.10% TypeScript 28.02% HTML 2.13% CSS 12.91%

media's Introduction


Capacitor Media

@capacitor-community/media

Capacitor community plugin for enabling extra media capabilities


Maintainers

Maintainer GitHub Social
Stewan Silva stewwan @StewanSilva

Notice ๐Ÿš€

We're starting fresh under an official org. If you were using the previous npm package capacitor-media, please update your package.json to @capacitor-community/media. Check out changelog for more info.

Installation

Using npm:

npm install @capacitor-community/media

Using yarn:

yarn add @capacitor-community/media

Sync native files:

npx cap sync

API

  • savePhoto
  • saveVideo
  • saveGif
  • createAlbum
  • getAlbums
  • getMedias only ios for now

Usage

import { Media } from '@capacitor-community/media';
const media = new Media();

//
// Save video to a specific album
media
  .saveVideo({ path: '/path/to/the/file', album: 'My Album' })
  .then(console.log)
  .catch(console.log);

//
// Get a list of user albums
media
  .getAlbums()
  .then(console.log) // -> { albums: [{name:'My Album', identifier:'A1-B2-C3-D4'}, {name:'My Another Album', identifier:'E5-F6-G7-H8'}]}
  .catch(console.log);

Disclaimer

Make sure you pass the correct album parameter according to the platform

album: this.platform.is('ios') ? album.identifier : album.name;

iOS setup

  • ionic start my-cap-app --capacitor
  • cd my-cap-app
  • npm install โ€”-save @capacitor-community/media
  • mkdir www && touch www/index.html
  • npx cap add ios
  • npx cap open ios
  • sign your app at xcode (general tab)

Tip: every time you change a native code you may need to clean up the cache (Product > Clean build folder) and then run the app again.

Android setup

  • ionic start my-cap-app --capacitor
  • cd my-cap-app
  • npm install โ€”-save @capacitor-community/media
  • mkdir www && touch www/index.html
  • npx cap add android
  • npx cap open android
  • [extra step] in android case we need to tell Capacitor to initialise the plugin:

on your MainActivity.java file add import com.getcapacitor.community.media.MediaPlugin; and then inside the init callback add(MediaPlugin.class);

Now you should be set to go. Try to run your client using ionic cap run android --livereload.

Tip: every time you change a native code you may need to clean up the cache (Build > Clean Project | Build > Rebuild Project) and then run the app again.

Example

License

MIT

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Stew

๐Ÿ’ป ๐Ÿ“–

Zachary Keeton

๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind welcome!

media's People

Contributors

stewones avatar pgrimaud avatar zakton5 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.