|
@@ -14,6 +14,7 @@ import android.provider.MediaStore.Video.Thumbnails;
|
14
|
14
|
import android.graphics.Bitmap;
|
15
|
15
|
import android.os.Environment;
|
16
|
16
|
import android.util.Log;
|
|
17
|
+import android.media.MediaMetadataRetriever;
|
17
|
18
|
import java.util.UUID;
|
18
|
19
|
import java.io.File;
|
19
|
20
|
import java.io.OutputStream;
|
|
@@ -36,7 +37,10 @@ public class RNThumbnailModule extends ReactContextBaseJavaModule {
|
36
|
37
|
@ReactMethod
|
37
|
38
|
public void get(String filePath, Promise promise) {
|
38
|
39
|
filePath = filePath.replace("file://","");
|
39
|
|
- Bitmap image = ThumbnailUtils.createVideoThumbnail(filePath, Thumbnails.MINI_KIND);
|
|
40
|
+ MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
|
41
|
+ retriever.setDataSource(filePath);
|
|
42
|
+ Bitmap image = retriever.getFrameAtTime(1000000, MediaMetadataRetriever.OPTION_CLOSEST_SYNC);
|
|
43
|
+
|
40
|
44
|
String fullPath = Environment.getExternalStorageDirectory().getAbsolutePath();
|
41
|
45
|
|
42
|
46
|
try {
|