Skip to content

Commit

Permalink
Merge pull request #16 from Qeepsake/bugfix/change-getduration-signature
Browse files Browse the repository at this point in the history
fix(getduration-signature): Changes the getDuration signature to getV…
  • Loading branch information
tdbrian authored Dec 23, 2021
2 parents 1a42197 + ace4bb7 commit d13446d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';

import { StyleSheet, View, Text, Button } from 'react-native';
import {
getDuration,
getVideoDuration,
getDimensions,
getMimeType,
getTimestamp,
Expand Down Expand Up @@ -40,7 +40,7 @@ export default function App() {
console.log('Results from @qeepsake/react-native-file-utils:');
console.log('-------------');

const duration = await getDuration(uri, mediaType);
const duration = await getVideoDuration(uri);
console.log('duration:');
console.log(duration);

Expand Down
6 changes: 1 addition & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ const FileUtils = NativeModules.FileUtils
* @param uri The full on device uri for the media item.
* @returns Duration of the video in number of seconds.
*/
export async function getDuration(
uri: string,
mediaType: 'video' | 'image'
): Promise<number> {
if (mediaType !== 'video') return 0;
export async function getVideoDuration(uri: string): Promise<number> {
return FileUtils.getDuration(uri);
}

Expand Down

0 comments on commit d13446d

Please sign in to comment.