Permalink
Browse files

Adding video play duration for camera roll

Reviewed By: zjj010104

Differential Revision: D5427454

fbshipit-source-id: 49b9fb2acf8f5093257780c927720776f3fae286
  • Loading branch information...
Nivetha Singara Vadivelu authored and facebook-github-bot committed Jul 15, 2017
1 parent cb9b266 commit 636a21b67e8bc1ec254abe8c4bb2ea740e7652a4
Showing with 9 additions and 0 deletions.
  1. +3 −0 Libraries/CameraRoll/CameraRoll.js
  2. +6 −0 Libraries/CameraRoll/RCTCameraRollManager.m
@@ -88,6 +88,9 @@ const getPhotosReturnChecker = createStrictShapeTypeChecker({
height: PropTypes.number.isRequired,
width: PropTypes.number.isRequired,
isStored: PropTypes.bool,
// TODO (nivethavadivelu) Need to add changes to Android before
// setting it as required
playableDuration: PropTypes.number,
}).isRequired,
timestamp: PropTypes.number.isRequired,
location: createStrictShapeTypeChecker({
@@ -187,6 +187,11 @@ static void RCTResolvePromise(RCTPromiseResolveBlock resolve,
CLLocation *loc = [result valueForProperty:ALAssetPropertyLocation];
NSDate *date = [result valueForProperty:ALAssetPropertyDate];
NSString *filename = [result defaultRepresentation].filename;
int64_t duration = 0;
if ([[result valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypeVideo]) {
duration = [[result valueForProperty:ALAssetPropertyDuration] intValue];
}
[assets addObject:@{
@"node": @{
@"type": [result valueForProperty:ALAssetPropertyType],
@@ -197,6 +202,7 @@ static void RCTResolvePromise(RCTPromiseResolveBlock resolve,
@"height": @(dimensions.height),
@"width": @(dimensions.width),
@"isStored": @YES,
@"playableDuration": @(duration),
},
@"timestamp": @(date.timeIntervalSince1970),
@"location": loc ? @{

0 comments on commit 636a21b

Please sign in to comment.