Skip to content

zi6xuan/react-native-media-meta

 
 

Repository files navigation

React Native Media Meta NPM version

Get media file metadata in your React Native app

Installation

$ npm install react-native-media-meta --save
$ react-native link

Usage

import MediaMeta from 'react-native-media-meta';
const path = '<your file path here>';

MediaMeta.get(path)
  .then(metadata => console.log(metadata))
  .catch(err => console.error(err));

API

MediaMeta.get(path, options) - Promise

Options: Object

  • getThumb - Boolean, if false no thumb is returned.
  • thumbFormatAsJPG - Boolean, if false PNG format is returned.
  • thumbCompression - Float eg 0.5. If thumbFormatAsJPG, this compression is used.
  • thumbMaxWidth - the max thumbnail width in pixels.
  • thumbMaxHeight - the max thumbnail height in pixels.

Resolve: Object - included following keys (If it's found)

  • thumb - Base64 image string (video: get first frame, audio: get artwork if exist)
  • duration (video only)
  • width - the thumb width
  • height - the thumb height
  • Others:

[Android] We using FFmpegMediaMetadataRetriever, see RNMediaMeta.java#L36 for more information. [iOS] We using official AVMatadataItem, see RNMediaMeta.m#L9 for more information.

License

MIT

About

Get media file metadata in your React Native app

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 41.4%
  • Java 38.4%
  • JavaScript 11.8%
  • Python 6.2%
  • Ruby 2.2%