@@ -92,7 +92,6 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
9292 .setImageEngine(imageEngine)
9393 .setSelectedData(dataList)
9494 .setSelectorUIStyle(style)
95-
9695 .apply {
9796 if (isCrop) {
9897 setCropOption(config.crop)
@@ -129,6 +128,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
129128 setCameraInterceptListener(CameraEngine (appContext, cameraConfig))
130129 }
131130 }
131+ .setVideoThumbnailListener(VideoThumbnailEngine (getVideoThumbnailDir()))
132132 .setImageSpanCount(config.numberOfColumn?.toInt() ? : 3 )
133133 .setMaxSelectNum(maxSelect)
134134 .isDirectReturnSingle(true )
@@ -307,7 +307,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
307307 .setLanguage(getLanguage(config.language))
308308 .setSelectorUIStyle(previewStyle)
309309 .isPreviewFullScreenMode(true )
310- .isAutoVideoPlay(true )
310+ .isAutoVideoPlay(config.videoAutoPlay == true )
311311 .setVideoPlayerEngine(ExoPlayerEngine ())
312312 .isVideoPauseResumePlay(true )
313313 .setCustomLoadingListener(getCustomLoadingListener())
@@ -334,6 +334,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
334334 .setCameraInterceptListener(CameraEngine (appContext, config))
335335 .isQuickCapture(true )
336336 .isOriginalControl(true )
337+ .setVideoThumbnailListener(VideoThumbnailEngine (getVideoThumbnailDir()))
337338 .apply {
338339 if (config.crop != null ) {
339340 setCropEngine(CropEngine (cropOption))
@@ -372,6 +373,15 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
372373 }
373374 }
374375
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+
375385
376386 private fun getLanguage (language : Language ): Int {
377387 return when (language) {
@@ -571,16 +581,22 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
571581 if (item.mimeType.startsWith(" video/" )) ResultType .VIDEO else ResultType .IMAGE
572582
573583 var path = item.path
574-
575584 var width: Double = item.width.toDouble()
576585 var height: Double = item.height.toDouble()
577586
587+ val thumbnail = item.videoThumbnailPath?.let {
588+ if (! it.startsWith(" file://" )) " file://$it " else it
589+ }
590+
578591 if (item.isCut) {
579592 path = " file://${item.cutPath} "
580593 width = item.cropImageWidth.toDouble()
581594 height = item.cropImageHeight.toDouble()
582595 }
583596
597+ if (! path.startsWith(" file://" ) && ! path.startsWith(" content://" ) && type == ResultType .IMAGE )
598+ path = " file://$path "
599+
584600 val media = Result (
585601 localIdentifier = item.id.toString(),
586602 width,
@@ -595,7 +611,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
595611 path,
596612 type,
597613 fileName = item.fileName,
598- thumbnail = item.videoThumbnailPath ,
614+ thumbnail = thumbnail ,
599615 duration = item.duration.toDouble()
600616 )
601617
0 commit comments