@@ -92,7 +92,6 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
92
92
.setImageEngine(imageEngine)
93
93
.setSelectedData(dataList)
94
94
.setSelectorUIStyle(style)
95
-
96
95
.apply {
97
96
if (isCrop) {
98
97
setCropOption(config.crop)
@@ -129,6 +128,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
129
128
setCameraInterceptListener(CameraEngine (appContext, cameraConfig))
130
129
}
131
130
}
131
+ .setVideoThumbnailListener(VideoThumbnailEngine (getVideoThumbnailDir()))
132
132
.setImageSpanCount(config.numberOfColumn?.toInt() ? : 3 )
133
133
.setMaxSelectNum(maxSelect)
134
134
.isDirectReturnSingle(true )
@@ -307,7 +307,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
307
307
.setLanguage(getLanguage(config.language))
308
308
.setSelectorUIStyle(previewStyle)
309
309
.isPreviewFullScreenMode(true )
310
- .isAutoVideoPlay(true )
310
+ .isAutoVideoPlay(config.videoAutoPlay == true )
311
311
.setVideoPlayerEngine(ExoPlayerEngine ())
312
312
.isVideoPauseResumePlay(true )
313
313
.setCustomLoadingListener(getCustomLoadingListener())
@@ -334,6 +334,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
334
334
.setCameraInterceptListener(CameraEngine (appContext, config))
335
335
.isQuickCapture(true )
336
336
.isOriginalControl(true )
337
+ .setVideoThumbnailListener(VideoThumbnailEngine (getVideoThumbnailDir()))
337
338
.apply {
338
339
if (config.crop != null ) {
339
340
setCropEngine(CropEngine (cropOption))
@@ -372,6 +373,15 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
372
373
}
373
374
}
374
375
376
+ private fun getVideoThumbnailDir (): String {
377
+ val externalFilesDir: File ? = appContext.getExternalFilesDir(" " )
378
+ val customFile = File (externalFilesDir?.absolutePath, " Thumbnail" )
379
+ if (! customFile.exists()) {
380
+ customFile.mkdirs()
381
+ }
382
+ return customFile.absolutePath + File .separator
383
+ }
384
+
375
385
376
386
private fun getLanguage (language : Language ): Int {
377
387
return when (language) {
@@ -571,16 +581,22 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
571
581
if (item.mimeType.startsWith(" video/" )) ResultType .VIDEO else ResultType .IMAGE
572
582
573
583
var path = item.path
574
-
575
584
var width: Double = item.width.toDouble()
576
585
var height: Double = item.height.toDouble()
577
586
587
+ val thumbnail = item.videoThumbnailPath?.let {
588
+ if (! it.startsWith(" file://" )) " file://$it " else it
589
+ }
590
+
578
591
if (item.isCut) {
579
592
path = " file://${item.cutPath} "
580
593
width = item.cropImageWidth.toDouble()
581
594
height = item.cropImageHeight.toDouble()
582
595
}
583
596
597
+ if (! path.startsWith(" file://" ) && ! path.startsWith(" content://" ) && type == ResultType .IMAGE )
598
+ path = " file://$path "
599
+
584
600
val media = Result (
585
601
localIdentifier = item.id.toString(),
586
602
width,
@@ -595,7 +611,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
595
611
path,
596
612
type,
597
613
fileName = item.fileName,
598
- thumbnail = item.videoThumbnailPath ,
614
+ thumbnail = thumbnail ,
599
615
duration = item.duration.toDouble()
600
616
)
601
617
0 commit comments