Adding video play duration for camera roll
Reviewed By: zjj010104 Differential Revision: D5427454 fbshipit-source-id: 49b9fb2acf8f5093257780c927720776f3fae286
This commit is contained in:
parent
479bc6e5d8
commit
0628eaec67
|
@ -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 @@ RCT_EXPORT_METHOD(getPhotos:(NSDictionary *)params
|
|||
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 @@ RCT_EXPORT_METHOD(getPhotos:(NSDictionary *)params
|
|||
@"height": @(dimensions.height),
|
||||
@"width": @(dimensions.width),
|
||||
@"isStored": @YES,
|
||||
@"playableDuration": @(duration),
|
||||
},
|
||||
@"timestamp": @(date.timeIntervalSince1970),
|
||||
@"location": loc ? @{
|
||||
|
|
Loading…
Reference in New Issue