Commit 98e93870 authored by 少言's avatar 少言

fix iOS 视频size

change 安卓包名
parent 86a93d38
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.reactlibrary"> package="com.syanpicker">
<application> <application>
</application> </application>
......
package com.reactlibrary; package com.syanpicker;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
......
package com.reactlibrary; package com.syanpicker;
import com.facebook.react.ReactPackage; import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule; import com.facebook.react.bridge.JavaScriptModule;
...@@ -24,4 +24,4 @@ public class RNSyanImagePickerPackage implements ReactPackage { ...@@ -24,4 +24,4 @@ public class RNSyanImagePickerPackage implements ReactPackage {
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList(); return Collections.emptyList();
} }
} }
\ No newline at end of file
...@@ -95,9 +95,7 @@ RCT_EXPORT_METHOD(openVideoPicker:(NSDictionary *)options callback:(RCTResponseS ...@@ -95,9 +95,7 @@ RCT_EXPORT_METHOD(openVideoPicker:(NSDictionary *)options callback:(RCTResponseS
} }
- (void)openTZImagePicker:(NSDictionary *)options callback:(RCTResponseSenderBlock)callback { - (void)openTZImagePicker:(NSDictionary *)options callback:(RCTResponseSenderBlock)callback {
// 照片最大可选张数
NSInteger imageCount = [options sy_integerForKey:@"imageCount"]; NSInteger imageCount = [options sy_integerForKey:@"imageCount"];
// 显示内部拍照按钮
BOOL isCamera = [options sy_boolForKey:@"isCamera"]; BOOL isCamera = [options sy_boolForKey:@"isCamera"];
BOOL isCrop = [options sy_boolForKey:@"isCrop"]; BOOL isCrop = [options sy_boolForKey:@"isCrop"];
BOOL allowPickingGif = [options sy_boolForKey:@"allowPickingGif"]; BOOL allowPickingGif = [options sy_boolForKey:@"allowPickingGif"];
...@@ -158,8 +156,7 @@ RCT_EXPORT_METHOD(openVideoPicker:(NSDictionary *)options callback:(RCTResponseS ...@@ -158,8 +156,7 @@ RCT_EXPORT_METHOD(openVideoPicker:(NSDictionary *)options callback:(RCTResponseS
NSMutableDictionary *video = [NSMutableDictionary dictionary]; NSMutableDictionary *video = [NSMutableDictionary dictionary];
video[@"uri"] = outputPath; video[@"uri"] = outputPath;
video[@"fileName"] = [asset valueForKey:@"filename"]; video[@"fileName"] = [asset valueForKey:@"filename"];
PHAssetResource *resource = [[PHAssetResource assetResourcesForAsset:asset] firstObject]; NSInteger size = [[NSFileManager defaultManager] attributesOfItemAtPath:outputPath error:nil].fileSize;
long long size = [[resource valueForKey:@"fileSize"] longLongValue];
video[@"size"] = @(size); video[@"size"] = @(size);
if (asset.mediaType == PHAssetMediaTypeVideo) { if (asset.mediaType == PHAssetMediaTypeVideo) {
video[@"type"] = @"video"; video[@"type"] = @"video";
...@@ -194,8 +191,7 @@ RCT_EXPORT_METHOD(openVideoPicker:(NSDictionary *)options callback:(RCTResponseS ...@@ -194,8 +191,7 @@ RCT_EXPORT_METHOD(openVideoPicker:(NSDictionary *)options callback:(RCTResponseS
NSMutableDictionary *video = [NSMutableDictionary dictionary]; NSMutableDictionary *video = [NSMutableDictionary dictionary];
video[@"uri"] = outputPath; video[@"uri"] = outputPath;
video[@"fileName"] = [asset valueForKey:@"filename"]; video[@"fileName"] = [asset valueForKey:@"filename"];
PHAssetResource *resource = [[PHAssetResource assetResourcesForAsset:asset] firstObject]; NSInteger size = [[NSFileManager defaultManager] attributesOfItemAtPath:outputPath error:nil].fileSize;
long long size = [[resource valueForKey:@"fileSize"] longLongValue];
video[@"size"] = @(size); video[@"size"] = @(size);
if (asset.mediaType == PHAssetMediaTypeVideo) { if (asset.mediaType == PHAssetMediaTypeVideo) {
video[@"type"] = @"video"; video[@"type"] = @"video";
......
{ {
"name": "react-native-syan-image-picker", "name": "react-native-syan-image-picker",
"version": "0.3.3", "version": "0.3.4",
"description": "React-Native 多图片选择 支持裁剪 压缩", "description": "React-Native 多图片选择 支持裁剪 压缩",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment