Skip to content

lokdevp/react-native-media-meta

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Native Media Meta

Get media file metadata in your React Native app

Modifications from the orginal repo

Changes are only for Android

  • Only audio metadata (video files ignored)
  • Duration in seconds
  • Chapters metadata for audio

Installation

$ npm install git+https://github.com/lokdevp/react-native-media-meta.git
$ 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));
// for metadata with chapters
const metadataWithChapters = await MediaMeta.get(path, {
          getChapters: true,
});

API

MediaMeta.get(path) - Promise

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

  • thumb - Base64 image string (audio: get artwork if exist)
  • duration
  • 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 43.2%
  • Java 34.9%
  • JavaScript 14.1%
  • Python 7.8%